org.jbox2d.collision
Class TOI
java.lang.Object
org.jbox2d.collision.TOI
public class TOI
- extends Object
Handles conservative advancement to compute time of impact between shapes.
Constructor Summary |
TOI()
|
Method Summary |
static float |
timeOfImpact(Shape shape1,
Sweep sweep1,
Shape shape2,
Sweep sweep2)
Compute the time when two shapes begin to touch or touch at a closer distance. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TOI
public TOI()
timeOfImpact
public static final float timeOfImpact(Shape shape1,
Sweep sweep1,
Shape shape2,
Sweep sweep2)
- Compute the time when two shapes begin to touch or touch at a closer distance.
Warning: the sweeps must have the same time interval.
- Returns:
- the fraction between [0,1] in which the shapes first touch.
fraction=0 means the shapes begin touching/overlapped, and fraction=1 means the shapes don't touch.