Emini Physics Engine 1.3.5a API Documentation

at.emini.physics2D
Class Collision

java.lang.Object
  extended by at.emini.physics2D.Collision

public class Collision
extends java.lang.Object

Detects collisions of two bodies.
For both bodies (or body and landscape) each relevant projection direction is tested for overlap (see also Shape.mUniqueAxesIndices). If one direction can be determined, where a gap is between both objects, there is no intersection.
Otherwise the projection info can be used to find the collision point(s).
Only convex polygons are considered, so it is ensured that at most two relevant collision points exist.

Author:
Alexander Adensamer

Constructor Summary
Collision()
           
 
Method Summary
static Contact detectCollision(Body b1, Body b2)
          Detects contacts between two bodies.
protected static FXVector detectCollision(Body b1, float xFX, float yFX)
          Detects contacts between a body and a particle.
static Contact detectCollision(Body b1, int index1, Body b2, int index2)
           
protected static Contact detectCollision(Body b1, int index1, Landscape landscape, int index)
           
protected static Contact detectCollision(Body b1, Landscape landscape, int index)
          Detects contacts between a body and a landscape segment.
protected static FXVector detectCollision(Landscape landscape, int index, float xFX, float yFX, float xOldFX, float yOldFX)
          Detects collision of a landscape segment and a particle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Collision

public Collision()
Method Detail

detectCollision

public static Contact detectCollision(Body b1,
                                      Body b2)
Detects contacts between two bodies. No more than two contact points are assumed between two (convex) shapes. If the two bodies are not touching or intersecting, null is returned. If a single Contact point is detected, it is returned. If two contact points exist, a double contact is returned.
The method takes any body and calls a method depending on the body shapes (circle, polygon)

Parameters:
b1 - Body 1 of the collision
b2 - Body 2 of the collision
Returns:
the found contact, null if none found

detectCollision

public static Contact detectCollision(Body b1,
                                      int index1,
                                      Body b2,
                                      int index2)

detectCollision

protected static Contact detectCollision(Body b1,
                                         Landscape landscape,
                                         int index)
Detects contacts between a body and a landscape segment. No more than two contact points are assumed between the convex shape and the line. If the body and line are not touching or intersecting, null is returned. If a single Contact point is detected, it is returned. If two contact points exist, a double contact is returned.
The method takes any body and calls a method depending on the body shape (circle, polygon)

Parameters:
b1 - Body 1 of the collision
landscape - the landscape object
index - the index of the line in the landscape
Returns:
the found contact, null if none found

detectCollision

protected static Contact detectCollision(Body b1,
                                         int index1,
                                         Landscape landscape,
                                         int index)

detectCollision

protected static FXVector detectCollision(Landscape landscape,
                                          int index,
                                          float xFX,
                                          float yFX,
                                          float xOldFX,
                                          float yOldFX)
Detects collision of a landscape segment and a particle.

Parameters:
landscape -
index -
xFX -
yFX -
xOldFX -
yOldFX -
Returns:
collision vector at the distance that the point has to move to exactly touch

detectCollision

protected static FXVector detectCollision(Body b1,
                                          float xFX,
                                          float yFX)
Detects contacts between a body and a particle.

Parameters:
b1 -
xFX -
yFX -
Returns:
the scaled contact normal.

Emini Physics Engine 1.3.5a API Documentation

Emini Physics Engine 1.3.5a API Documentation - Copyright 2014 Alexander Adensamer