Package org.jbox2d.collision
Class Collision
java.lang.Object
org.jbox2d.collision.Collision
public class Collision
extends java.lang.Object
Functions used for computing contact points, distance queries, and TOI queries. Collision methods
are non-static for pooling speed, retrieve a collision object from the
.
Should not be finalructed.
invalid reference
SingletonPool
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Used for computing contact manifolds.private static class
Java-specific class for returning edge results(package private) static class
This structure is used to keep track of the best separating axis.(package private) static class
This class collides and edge and a polygon, taking into account edge adjacency.static enum
This is used for determining the state of contact points.(package private) static class
Reference face used for clipping(package private) static class
This holds polygon B expressed in frame A. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Distance.SimplexCache
private final ContactID
private final Collision.ClipVertex[]
private final Collision.ClipVertex[]
private final Collision.EPCollider
private static Vec2
private final Vec2
private final Vec2
private final Collision.ClipVertex[]
private final DistanceInput
private final Vec2
private final Vec2
private final Vec2
static final int
private final DistanceOutput
private final Vec2
private final Vec2
private final IWorldPool
private final Vec2
private final Collision.EdgeResults
private final Collision.EdgeResults
private final Vec2
private final Vec2
private final Vec2
private final Vec2
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final int
clipSegmentToLine
(Collision.ClipVertex[] vOut, Collision.ClipVertex[] vIn, Vec2 normal, float offset, int vertexIndexA) Clipping for contact manifolds.final void
collideCircles
(Manifold manifold, CircleShape circle1, Transform xfA, CircleShape circle2, Transform xfB) Compute the collision manifold between two circles.void
collideEdgeAndCircle
(Manifold manifold, EdgeShape edgeA, Transform xfA, CircleShape circleB, Transform xfB) void
collideEdgeAndPolygon
(Manifold manifold, EdgeShape edgeA, Transform xfA, PolygonShape polygonB, Transform xfB) final void
collidePolygonAndCircle
(Manifold manifold, PolygonShape polygon, Transform xfA, CircleShape circle, Transform xfB) Compute the collision manifold between a polygon and a circle.final void
collidePolygons
(Manifold manifold, PolygonShape polyA, Transform xfA, PolygonShape polyB, Transform xfB) Compute the collision manifold between two polygons.final float
edgeSeparation
(PolygonShape poly1, Transform xf1, int edge1, PolygonShape poly2, Transform xf2) Find the separation between poly1 and poly2 for a given edge normal on poly1.final void
findIncidentEdge
(Collision.ClipVertex[] c, PolygonShape poly1, Transform xf1, int edge1, PolygonShape poly2, Transform xf2) final void
findMaxSeparation
(Collision.EdgeResults results, PolygonShape poly1, Transform xf1, PolygonShape poly2, Transform xf2) Find the max separation between poly1 and poly2 using edge normals from poly1.static final void
getPointStates
(Collision.PointState[] state1, Collision.PointState[] state2, Manifold manifold1, Manifold manifold2) Compute the point states given two manifolds.final boolean
testOverlap
(Shape shapeA, int indexA, Shape shapeB, int indexB, Transform xfA, Transform xfB) Determine if two generic shapes overlap.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
NULL_FEATURE
public static final int NULL_FEATURE- See Also:
-
pool
-
input
-
cache
-
output
-
d
-
temp
-
results1
-
results2
-
incidentEdge
-
localTangent
-
localNormal
-
planePoint
-
tangent
-
v11
-
v12
-
clipPoints1
-
clipPoints2
-
Q
-
e
-
cf
-
e1
-
P
-
n
-
collider
-
-
Constructor Details
-
Collision
-
-
Method Details
-
testOverlap
public final boolean testOverlap(Shape shapeA, int indexA, Shape shapeB, int indexB, Transform xfA, Transform xfB) Determine if two generic shapes overlap.- Parameters:
shapeA
-shapeB
-xfA
-xfB
-- Returns:
-
getPointStates
public static final void getPointStates(Collision.PointState[] state1, Collision.PointState[] state2, Manifold manifold1, Manifold manifold2) Compute the point states given two manifolds. The states pertain to the transition from manifold1 to manifold2. So state1 is either persist or remove while state2 is either add or persist.- Parameters:
state1
-state2
-manifold1
-manifold2
-
-
clipSegmentToLine
public static final int clipSegmentToLine(Collision.ClipVertex[] vOut, Collision.ClipVertex[] vIn, Vec2 normal, float offset, int vertexIndexA) Clipping for contact manifolds. Sutherland-Hodgman clipping.- Parameters:
vOut
-vIn
-normal
-offset
-- Returns:
-
collideCircles
public final void collideCircles(Manifold manifold, CircleShape circle1, Transform xfA, CircleShape circle2, Transform xfB) Compute the collision manifold between two circles.- Parameters:
manifold
-circle1
-xfA
-circle2
-xfB
-
-
collidePolygonAndCircle
public final void collidePolygonAndCircle(Manifold manifold, PolygonShape polygon, Transform xfA, CircleShape circle, Transform xfB) Compute the collision manifold between a polygon and a circle.- Parameters:
manifold
-polygon
-xfA
-circle
-xfB
-
-
edgeSeparation
public final float edgeSeparation(PolygonShape poly1, Transform xf1, int edge1, PolygonShape poly2, Transform xf2) Find the separation between poly1 and poly2 for a given edge normal on poly1.- Parameters:
poly1
-xf1
-edge1
-poly2
-xf2
-
-
findMaxSeparation
public final void findMaxSeparation(Collision.EdgeResults results, PolygonShape poly1, Transform xf1, PolygonShape poly2, Transform xf2) Find the max separation between poly1 and poly2 using edge normals from poly1.- Parameters:
poly1
-xf1
-poly2
-xf2
-edgeIndex
-
-
findIncidentEdge
public final void findIncidentEdge(Collision.ClipVertex[] c, PolygonShape poly1, Transform xf1, int edge1, PolygonShape poly2, Transform xf2) -
collidePolygons
public final void collidePolygons(Manifold manifold, PolygonShape polyA, Transform xfA, PolygonShape polyB, Transform xfB) Compute the collision manifold between two polygons.- Parameters:
manifold
-polygon1
-xf1
-polygon2
-xf2
-
-
collideEdgeAndCircle
public void collideEdgeAndCircle(Manifold manifold, EdgeShape edgeA, Transform xfA, CircleShape circleB, Transform xfB) -
collideEdgeAndPolygon
public void collideEdgeAndPolygon(Manifold manifold, EdgeShape edgeA, Transform xfA, PolygonShape polygonB, Transform xfB)
-