Package org.jbox2d.collision
Class Distance
- java.lang.Object
-
- org.jbox2d.collision.Distance
-
public class Distance extends java.lang.Object
This 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 class
Distance.DistanceProxy
A distance proxy is used by the GJK algorithm.private class
Distance.Simplex
static class
Distance.SimplexCache
Used to warm start Distance.private class
Distance.SimplexVertex
GJK using Voronoi regions (Christer Ericson) and Barycentric coordinates.
-
Field Summary
Fields Modifier and Type Field Description private Vec2
closestPoint
private Vec2
d
static int
GJK_CALLS
static int
GJK_ITERS
static int
GJK_MAX_ITERS
private Vec2
normal
private int[]
saveA
private int[]
saveB
private Distance.Simplex
simplex
private Vec2
temp
-
Constructor Summary
Constructors Constructor Description Distance()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
distance(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
-
-
-