-
- All Known Implementing Classes:
ConservativeAdvancement
public interface TimeOfImpactDetector
Interface representing a time of impact algorithm.Sometimes called Continuous Collision Detection, implementing classes are used to detect collisions between
Convex
Shape
s given their initial and final state of a time step. This information can then be used to solve a collision that was missed during that period.These algorithms are generally very computationally expensive.
- Since:
- 1.2.0
- Version:
- 3.1.5
- Author:
- William Bittle
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
getTimeOfImpact(Convex convex1, Transform transform1, Vector2 dp1, double da1, Convex convex2, Transform transform2, Vector2 dp2, double da2, double t1, double t2, TimeOfImpact toi)
boolean
getTimeOfImpact(Convex convex1, Transform transform1, Vector2 dp1, double da1, Convex convex2, Transform transform2, Vector2 dp2, double da2, TimeOfImpact toi)
-
-
-
Method Detail
-
getTimeOfImpact
boolean getTimeOfImpact(Convex convex1, Transform transform1, Vector2 dp1, double da1, Convex convex2, Transform transform2, Vector2 dp2, double da2, TimeOfImpact toi)
Detects whether the givenConvex
Shape
s collide given their current positions and orientation and the rate of change their position and orientation, returning the time of impact within an epsilon.If a collision is detected, the
toi
parameter will be filled with the time of impact and the separation at the time of impact.If a time of impact is detected, the time will be in the range [0, 1]. This can be used, along with the change and position and orientation, to place to the shapes at the time of impact. Note that the shapes will still be separated, by a small amount, at the time of impact.
This method returns false if the shape do not collide.
- Parameters:
convex1
- the first convex shapetransform1
- the first convex shape's transformdp1
- the change in position of the first shapeda1
- the change in orientation of the first shapeconvex2
- the second convex shapetransform2
- the second convex shape's transformdp2
- the change in position of the second shapeda2
- the change in orientation of the second shapetoi
- theTimeOfImpact
object to be filled in the case of a collision- Returns:
- boolean true if a collision was detected
- Since:
- 3.1.5
-
getTimeOfImpact
boolean getTimeOfImpact(Convex convex1, Transform transform1, Vector2 dp1, double da1, Convex convex2, Transform transform2, Vector2 dp2, double da2, double t1, double t2, TimeOfImpact toi)
Detects whether the givenConvex
Shape
s collide given their current positions and orientation and the rate of change their position and orientation in the time range of [t1, t2] and returning the time of impact within an epsilon.If a collision is detected, the
toi
parameter will be filled with the time of impact and the separation at the time of impact.If a time of impact is detected, the time will be in the range [0, 1]. This can be used, along with the change and position and orientation, to place to the shapes at the time of impact. Note that the shapes will still be separated, by a small amount, at the time of impact.
This method returns false if the shape do not collide.
- Parameters:
convex1
- the first convex shapetransform1
- the first convex shape's transformdp1
- the change in position of the first shapeda1
- the change in orientation of the first shapeconvex2
- the second convex shapetransform2
- the second convex shape's transformdp2
- the change in position of the second shapeda2
- the change in orientation of the second shapetoi
- theTimeOfImpact
object to be filled in the case of a collisiont1
- the lower time boundt2
- the upper time bound- Returns:
- boolean true if a collision was detected
- Since:
- 3.1.5
-
-