Interface AABB2d

  • All Known Subinterfaces:
    MAABB2d

    public interface AABB2d
    Read-only interface for axis-aligned bounding boxes in XY-plane.
    Since:
    9.10.2
    • Method Detail

      • create

        static AABB2d create​(AABB2d boundingBox)
        Returns a bounding box with the same bounds as in the given bounding box.
        Parameters:
        boundingBox - the bounding box whose bounds are set to the returned box
        Returns:
        a new bounding box with the same bounds as in the given bounding box
        Throws:
        IllegalArgumentException - if given bounding box is not valid, meaning that lowerBound is greater than upperBound in either dimension
        Since:
        9.10.2
      • create

        static AABB2d create​(Collection<Vector2d> points)
        Returns the minimum area axis-aligned bounding box for the given collection of points.
        Parameters:
        points - the points for which the minimum area axis-aligned bounding box is computed
        Returns:
        the minimum area axis-aligned bounding box for the given collection of points
        Since:
        9.10.2
      • create

        static AABB2d create​(Vector2d lowerBound,
                             Vector2d upperBound)
        Returns a bounding box with the given bounds. If lowerBound is greater than upperBound in either dimension, IllegalArgumentException is thrown.
        Parameters:
        lowerBound - the lower bound for the bounding box
        upperBound - the upper bound for the bounding box
        Returns:
        a bounding box with the given bounds
        Throws:
        IllegalArgumentException - if lowerBound is greater than upperBound in either dimension
        Since:
        9.10.2
      • contains

        boolean contains​(Vector2d point)
        Returns true if the given point is inside this bounding box. Points on the boundary of bounding boxes are also considered to be contained.
        Parameters:
        point - the point that is checked for containment
        Returns:
        true if the given point is contained in this bounding box
        Since:
        9.10.2
      • contains

        boolean contains​(AABB2d box)
        Returns true if the given bounding box is inside this bounding box.
        Parameters:
        box - the bounding box that is checked for containment
        Returns:
        true if the given bounding box is inside this bounding box
        Since:
        9.10.2
      • getCentroid

        MVector2d getCentroid()
        Returns a copy of the centroid vector of this bounding box.
        Returns:
        a copy of the centroid of this bounding box
        Since:
        9.10.2
      • getEdges

        List<Segment2d> getEdges()
        Returns the edges of this axis-aligned bounding box in counter clockwise order. The first edge is not specified.
        Returns:
        the edges of this axis-aligned bounding box in counter clockwise order
        Since:
        9.10.2
      • getLowerBound

        Vector2d getLowerBound()
        Returns the lower bound of this bounding box.
        Returns:
        the lower bound of this bounding box
        Since:
        9.10.2
      • getSizeX

        double getSizeX()
        Returns the size of this bounding box on the X axis.
        Returns:
        the size of this bounding box on the X axis
        Since:
        9.10.2
      • getSizeY

        double getSizeY()
        Returns the size of this bounding box on the Y axis.
        Returns:
        the size of this bounding box on the Y axis
        Since:
        9.10.2
      • getUpperBound

        Vector2d getUpperBound()
        Returns the upper bound of this bounding box.
        Returns:
        the upper bound of this bounding box
        Since:
        9.10.2
      • getVertices

        List<Vector2d> getVertices()
        Returns the vertices of this bounding box in counter clockwise order. If the box is degenerate, then returns an empty list. The first vertex is not specified.
        Returns:
        the vertices of this bounding box in counter clockwise order
        Since:
        9.10.2
      • getArea

        double getArea()
        Returns the area of this bounding box.
        Returns:
        the area of this bounding box
        Since:
        9.10.2
      • intersects

        boolean intersects​(AABB2d aabb)
        Returns true if this bounding box intersects the given bounding box.
        Parameters:
        aabb - the bounding box with which this box is checked for intersection
        Returns:
        true if this bounding box intersects the given bounding box
        Since:
        9.10.2
      • isDegenerate

        boolean isDegenerate()
        Returns true if the given bounding box is degenerate. A bounding box is considered degenerate if its area is zero or if its lower bound is greater than its upper bound in either dimension.
        Returns:
        true if the given bounding box is degenerate
        Since:
        9.10.2