Module technology.sola.engine
Class SeparatingAxisTheorem
java.lang.Object
technology.sola.engine.physics.utils.SeparatingAxisTheorem
SeparatingAxisTheorem contains methods for checking whether two convex polygons are colliding or not.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable MinimumTranslationVectorcheckCollision(Vector2D[] shapeA, Vector2D[] shapeB) Checks for collisions between to shapes.static @Nullable MinimumTranslationVectorcheckCollision(Vector2D[] shape, Vector2D circleCenter, float radius) Checks for collisions between a shape and a circle.
-
Constructor Details
-
SeparatingAxisTheorem
public SeparatingAxisTheorem()
-
-
Method Details
-
checkCollision
public static @Nullable MinimumTranslationVector checkCollision(Vector2D[] shapeA, Vector2D[] shapeB) Checks for collisions between to shapes. If a collision is detected theMinimumTranslationVectorwill be returned. If no collision is found, then null will be returned.- Parameters:
shapeA- the first array of points for a shape to check collisions withshapeB- the second array of points for a shape to check collisions with- Returns:
- the
MinimumTranslationVectorif a collision was found or else null
-
checkCollision
public static @Nullable MinimumTranslationVector checkCollision(Vector2D[] shape, Vector2D circleCenter, float radius) Checks for collisions between a shape and a circle. If a collision is detected theMinimumTranslationVectorwill be returned. If no collision is found, then null will be returned.- Parameters:
shape- the array of points for a shape to check collisions withcircleCenter- the circle center to check collisions withradius- the circle radius to check collisions with- Returns:
- the
MinimumTranslationVectorif a collision was found or else null
-