Package 

Class AxisAlignedBoundingBox

  • 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.

    • Constructor Detail

      • AxisAlignedBoundingBox

        AxisAlignedBoundingBox(Vec2 min, Vec2 max)
        Parameters:
        min - Lower bound of AABB vertex.
        max - Higher bound of AABB vertex.
    • Method Detail

      • getMin

         final Vec2 getMin()

        Lower left vertex of bounding box.

      • getMax

         final Vec2 getMax()

        Top right vertex of bounding box.

      • 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.