Module org.dyn4j

Class AxisAlignedBounds

  • All Implemented Interfaces:
    Bounds, Shiftable, Translatable

    public final class AxisAlignedBounds
    extends AbstractBounds
    implements Bounds, Translatable
    Represents a bounding region that is an Axis-Aligned bounding box.

    This class compares its AABB with the AABB of the given body and returns true if they do not overlap.

    Since:
    3.1.1
    Version:
    4.0.0
    Author:
    William Bittle
    • Constructor Detail

      • AxisAlignedBounds

        public AxisAlignedBounds​(double width,
                                 double height)
        Minimal constructor.
        Parameters:
        width - the width of the bounds; must be greater than zero
        height - the height of the bounds; must be greater than zero
        Throws:
        IllegalArgumentException - if either width or height are less than or equal to zero
    • Method Detail

      • isOutside

        public boolean isOutside​(AABB aabb)
        Description copied from interface: Bounds
        Returns true if the given AABB is fully outside the bounds.

        If the AABB is a degenerate AABB (has zero area) then it's considered to be outside the bounds.

        Specified by:
        isOutside in interface Bounds
        Parameters:
        aabb - the AABB to test
        Returns:
        boolean true if outside the bounds
      • getBounds

        public AABB getBounds()
        Returns the world space Axis-Aligned bounding box for this bounds object.
        Returns:
        AABB
      • getWidth

        public double getWidth()
        Returns the width of the bounds.
        Returns:
        double
      • getHeight

        public double getHeight()
        Returns the height of the bounds.
        Returns:
        double