-
- All Implemented Interfaces:
public final class AxisAlignedBoundingBox
Axis 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 class
AxisAlignedBoundingBox.Companion
-
Constructor Summary
Constructors Constructor Description AxisAlignedBoundingBox(Vec2 min, Vec2 max)
-
Method Summary
Modifier and Type Method Description final Vec2
getMin()
Lower left vertex of bounding box. final Unit
setMin(Vec2 min)
final Vec2
getMax()
Top right vertex of bounding box. final Unit
setMax(Vec2 max)
final Boolean
getIsValid()
final Unit
set(AxisAlignedBoundingBox aabb)
Sets the current objects bounds equal to that of the passed AABB argument. final Boolean
aabbOverlap(Vec2 point)
Method to check if a point resides inside an AABB in object space. final Unit
addOffset(Vec2 offset)
Method to add offset to the AABB's bounds. String
toString()
final AxisAlignedBoundingBox
copy()
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.
-
-
-
-