org.jbox2d.collision
Class Distance
java.lang.Object
org.jbox2d.collision.Distance
public class Distance
- extends java.lang.Object
Implements the GJK algorithm for computing distance between shapes.
Method Summary |
static float |
distance(Vec2 x1,
Vec2 x2,
Shape shape1,
XForm xf1,
Shape shape2,
XForm xf2)
Find the closest distance between shapes shape1 and shape2,
and load the closest points into x1 and x2. |
protected static float |
DistanceCC(Vec2 x1,
Vec2 x2,
CircleShape circle1,
XForm xf1,
CircleShape circle2,
XForm xf2)
|
static float |
DistanceGeneric(Vec2 x1,
Vec2 x2,
SupportsGenericDistance shape1,
XForm xf1,
SupportsGenericDistance shape2,
XForm xf2)
Distance between any two objects that implement SupportsGenericDistance. |
protected static float |
DistancePC(Vec2 x1,
Vec2 x2,
PolygonShape polygon,
XForm xf1,
CircleShape circle,
XForm xf2)
|
protected static boolean |
InPoints(Vec2 w,
Vec2[] points,
int pointCount)
|
protected static int |
ProcessThree(Vec2 x1,
Vec2 x2,
Vec2[] p1s,
Vec2[] p2s,
Vec2[] points)
|
protected static int |
ProcessTwo(Vec2 x1,
Vec2 x2,
Vec2[] p1s,
Vec2[] p2s,
Vec2[] points)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
g_GJK_Iterations
public static int g_GJK_Iterations
Distance
public Distance()
ProcessTwo
protected static int ProcessTwo(Vec2 x1,
Vec2 x2,
Vec2[] p1s,
Vec2[] p2s,
Vec2[] points)
ProcessThree
protected static int ProcessThree(Vec2 x1,
Vec2 x2,
Vec2[] p1s,
Vec2[] p2s,
Vec2[] points)
InPoints
protected static boolean InPoints(Vec2 w,
Vec2[] points,
int pointCount)
DistanceGeneric
public static float DistanceGeneric(Vec2 x1,
Vec2 x2,
SupportsGenericDistance shape1,
XForm xf1,
SupportsGenericDistance shape2,
XForm xf2)
- Distance between any two objects that implement SupportsGenericDistance.
Note that x1 and x2 are passed so that they may store results - they must
be instantiated before being passed, and the contents will be lost.
- Parameters:
x1
- Set to closest point on shape1 (result parameter)x2
- Set to closest point on shape2 (result parameter)shape1
- Shape to testxf1
- Transform of shape1shape2
- Shape to testxf2
- Transform of shape2
- Returns:
DistanceCC
protected static float DistanceCC(Vec2 x1,
Vec2 x2,
CircleShape circle1,
XForm xf1,
CircleShape circle2,
XForm xf2)
DistancePC
protected static float DistancePC(Vec2 x1,
Vec2 x2,
PolygonShape polygon,
XForm xf1,
CircleShape circle,
XForm xf2)
distance
public static float distance(Vec2 x1,
Vec2 x2,
Shape shape1,
XForm xf1,
Shape shape2,
XForm xf2)
- Find the closest distance between shapes shape1 and shape2,
and load the closest points into x1 and x2.
Note that x1 and x2 are passed so that they may store results - they must
be instantiated before being passed, and the contents will be lost.
- Parameters:
x1
- Closest point on shape1 is put here (result parameter)x2
- Closest point on shape2 is put here (result parameter)shape1
- First shape to testxf1
- Transform of first shapeshape2
- Second shape to testxf2
- Transform of second shape