public class Collision

  1. Object
  2. Collision
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 SingletonPool. Should not be finalructed.

Nested types

class Collision.ClipVertexUsed for computing contact manifolds.
enum Collision.PointStateThis is used for determining the state of contact points.

Fields

public static final int NULL_FEATURE = 2147483647

Constructors

public Collision(IWorldPool argPool)

Methods

public final boolean testOverlap(Shape shapeA, int indexA, Shape shapeB, int indexB, Transform xfA, Transform xfB)Determine if two generic shapes overlap.
public static final void getPointStates(Collision.PointState[] state1, Collision.PointState[] state2, Manifold manifold1, Manifold manifold2)Compute the point states given two manifolds.
public static final int clipSegmentToLine(Collision.ClipVertex[] vOut, Collision.ClipVertex[] vIn, Vec2 normal, float offset, int vertexIndexA)Clipping for contact manifolds.
public final void collideCircles(Manifold manifold, CircleShape circle1, Transform xfA, CircleShape circle2, Transform xfB)Compute the collision manifold between two circles.
public final void collidePolygonAndCircle(Manifold manifold, PolygonShape polygon, Transform xfA, CircleShape circle, Transform xfB)Compute the collision manifold between a polygon and a circle.
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.
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.
public final void findIncidentEdge(Collision.ClipVertex[] c, PolygonShape poly1, Transform xf1, int edge1, PolygonShape poly2, Transform xf2)
public final void collidePolygons(Manifold manifold, PolygonShape polyA, Transform xfA, PolygonShape polyB, Transform xfB)Compute the collision manifold between two polygons.
public void collideEdgeAndCircle(Manifold manifold, EdgeShape edgeA, Transform xfA, CircleShape circleB, Transform xfB)
public void collideEdgeAndPolygon(Manifold manifold, EdgeShape edgeA, Transform xfA, PolygonShape polygonB, Transform xfB)

Inherited methods

Field details

NULL_FEATURE

public static final int NULL_FEATURE = 2147483647

Constructor details

Collision

public Collision(IWorldPool argPool)

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.

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.

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.

collideCircles

public final void collideCircles(Manifold manifold, CircleShape circle1, Transform xfA, CircleShape circle2, Transform xfB)
Compute the collision manifold between two circles.

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.

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.

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.

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.

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)