-
- All Implemented Interfaces:
public final class AxisAlignedBoundingBoxAxis aligned bounding box volume class. Allows the creation of bounding volumes to make broad phase collision check possible and easy to do.
Constructor to generate an AABB given a minimum and maximum bound in the form of two vectors.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classAxisAlignedBoundingBox.Companion
-
Constructor Summary
Constructors Constructor Description AxisAlignedBoundingBox(Vec2 min, Vec2 max)
-
Method Summary
Modifier and Type Method Description final Vec2getMin()Lower left vertex of bounding box. final UnitsetMin(Vec2 min)final Vec2getMax()Top right vertex of bounding box. final UnitsetMax(Vec2 max)final BooleangetIsValid()final Unitset(AxisAlignedBoundingBox aabb)Sets the current objects bounds equal to that of the passed AABB argument. final BooleanaabbOverlap(Vec2 point)Method to check if a point resides inside an AABB in object space. final UnitaddOffset(Vec2 offset)Method to add offset to the AABB's bounds. StringtoString()final AxisAlignedBoundingBoxcopy()Copy method to return a new AABB that's the same as the current object. -
-
Method Detail
-
getIsValid
final Boolean getIsValid()
-
set
final Unit set(AxisAlignedBoundingBox aabb)
Sets the current objects bounds equal to that of the passed AABB argument.
- Parameters:
aabb- An AABB bounding box.
-
aabbOverlap
final Boolean aabbOverlap(Vec2 point)
Method to check if a point resides inside an AABB in object space.
- Parameters:
point- A point to check if its inside the AABB's object space.
-
addOffset
final Unit addOffset(Vec2 offset)
Method to add offset to the AABB's bounds. Can be useful to convert from object to world space .
- Parameters:
offset- A vector to apply to the min and max vectors to translate the bounds and therefore AABB to desired position.
-
copy
final AxisAlignedBoundingBox copy()
Copy method to return a new AABB that's the same as the current object.
-
-
-
-