Package org.jbox2d.collision
Class Distance
- java.lang.Object
-
- org.jbox2d.collision.Distance
-
public class Distance extends java.lang.ObjectThis is non-static for faster pooling. To get an instance, use theSingletonPool, don't construct a distance object.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDistance.DistanceProxyA distance proxy is used by the GJK algorithm.private classDistance.Simplexstatic classDistance.SimplexCacheUsed to warm start Distance.private classDistance.SimplexVertexGJK using Voronoi regions (Christer Ericson) and Barycentric coordinates.
-
Field Summary
Fields Modifier and Type Field Description private Vec2closestPointprivate Vec2dstatic intGJK_CALLSstatic intGJK_ITERSstatic intGJK_MAX_ITERSprivate Vec2normalprivate int[]saveAprivate int[]saveBprivate Distance.Simplexsimplexprivate Vec2temp
-
Constructor Summary
Constructors Constructor Description Distance()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddistance(DistanceOutput output, Distance.SimplexCache cache, DistanceInput input)Compute the closest points between two shapes.
-
-
-
Field Detail
-
GJK_CALLS
public static int GJK_CALLS
-
GJK_ITERS
public static int GJK_ITERS
-
GJK_MAX_ITERS
public static int GJK_MAX_ITERS
-
simplex
private Distance.Simplex simplex
-
saveA
private int[] saveA
-
saveB
private int[] saveB
-
closestPoint
private Vec2 closestPoint
-
d
private Vec2 d
-
temp
private Vec2 temp
-
normal
private Vec2 normal
-
-
Method Detail
-
distance
public final void distance(DistanceOutput output, Distance.SimplexCache cache, DistanceInput input)
Compute the closest points between two shapes. Supports any combination of: CircleShape and PolygonShape. The simplex cache is input/output. On the first call set SimplexCache.count to zero.- Parameters:
output-cache-input-
-
-