net.java.dev.joode.collision.collider
Class Colliders

java.lang.Object
  extended by net.java.dev.joode.collision.collider.Colliders

public class Colliders
extends java.lang.Object

Author:
Tom Larkworthy

Field Summary
 net.java.dev.joode.collision.collider.Colliders.ColliderEntry[][] colliders
           
static Colliders INSTANCE
           
 
Method Summary
static void closestLineBoxPoints(Vector3 p1, Vector3 p2, Vector3 c, Matrix3 R, Vector3 side, Vector3 lret, Vector3 bret)
           
static void closestLineSegmentPoints(Vector3 a1, Vector3 a2, Vector3 b1, Vector3 b2, Vector3 cp1, Vector3 cp2)
           
static void cullPoints(int n, float[] p, int m, int i0, int[] iret)
          given n points in the plane (array p, of size 2*n), generate m points that best represent the whole set.
static int dCollide(Geom o1, Geom o2, int flags, ContactGeom[] contact, int contactIndex, boolean ignoreStatic)
          Handles the collision of two Geoms, deciding which collider to use and optionally skipping static-static collisions.
static int intersectRectQuad(float[] h, float[] p, float[] ret)
          find all the intersection points between the 2D rectangle with vertices at (+/-h[0],+/-h[1]) and the 2D quadrilateral with vertices (p[0],p[1]), (p[2],p[3]),(p[4],p[5]),(p[6],p[7]).
static float[] lineClosestApproach(Vector3 pa, Vector3 ua, Vector3 pb, Vector3 ub)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static Colliders INSTANCE

colliders

public net.java.dev.joode.collision.collider.Colliders.ColliderEntry[][] colliders
Method Detail

dCollide

public static int dCollide(Geom o1,
                           Geom o2,
                           int flags,
                           ContactGeom[] contact,
                           int contactIndex,
                           boolean ignoreStatic)
Handles the collision of two Geoms, deciding which collider to use and optionally skipping static-static collisions. Calls collide() on the correct collider, which handles the actual collision check. Amos Wenger: don't remove skip because it's useful to determine if static collisions should be detected or not

Parameters:
o1 -
o2 -
flags -
contact -
contactIndex -
ignoreStatic - true to skip static-static collisions
Returns:
the number of collisions

lineClosestApproach

public static float[] lineClosestApproach(Vector3 pa,
                                          Vector3 ua,
                                          Vector3 pb,
                                          Vector3 ub)
Parameters:
pa -
ua -
pb -
ub -
Returns:
{alpha,beta}

closestLineSegmentPoints

public static void closestLineSegmentPoints(Vector3 a1,
                                            Vector3 a2,
                                            Vector3 b1,
                                            Vector3 b2,
                                            Vector3 cp1,
                                            Vector3 cp2)

closestLineBoxPoints

public static void closestLineBoxPoints(Vector3 p1,
                                        Vector3 p2,
                                        Vector3 c,
                                        Matrix3 R,
                                        Vector3 side,
                                        Vector3 lret,
                                        Vector3 bret)

intersectRectQuad

public static int intersectRectQuad(float[] h,
                                    float[] p,
                                    float[] ret)
find all the intersection points between the 2D rectangle with vertices at (+/-h[0],+/-h[1]) and the 2D quadrilateral with vertices (p[0],p[1]), (p[2],p[3]),(p[4],p[5]),(p[6],p[7]). the intersection points are returned as x,y pairs in the 'ret' array. the number of intersection points is returned by the function (this will be in the range 0 to 8).


cullPoints

public static void cullPoints(int n,
                              float[] p,
                              int m,
                              int i0,
                              int[] iret)
given n points in the plane (array p, of size 2*n), generate m points that best represent the whole set. the definition of 'best' here is not predetermined - the idea is to select points that give good box-box collision detection behavior. the chosen point indexes are returned in the array iret (of size m). 'i0' is always the first entry in the array. n must be in the range [1..8]. m must be in the range [1..n]. i0 must be in the range [0..n-1]. From: collision_util.cpp