Interface AABB3d

  • All Known Subinterfaces:
    MAABB3d

    public interface AABB3d
    Read-only interface for axis-aligned bounding boxes in 3-dimensional space.
    Since:
    9.10.2
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean contains​(Vector3d point)
      Returns true if the given point is inside this bounding box.
      boolean contains​(AABB3d box)
      Returns true if the given bounding box is inside this bounding box.
      static AABB3d create​(Vector3d lowerBound, Vector3d upperBound)
      Returns a bounding box with the given bounds.
      static AABB3d create​(AABB3d boundingBox)
      Returns a new instance of a bounding box with the same bounds as in the given bounding box.
      static AABB3d create​(Collection<Vector3d> points)
      Returns the minimum volume axis-aligned bounding box for the given collection of points.
      double distance​(AABB3d box)
      Returns the minimum distance between this bounding box and the given bounding box.
      double distanceSquared​(AABB3d box)
      Returns the square of the minimum distance between this bounding box and the given bounding box.
      MVector3d getCentroid()
      Returns a copy of the centroid vector of this bounding box.
      Collection<Segment3d> getEdges()
      Returns the edges of this bounding box.
      Vector3d getLowerBound()
      Returns the lower bound of this bounding box.
      double getSizeX()
      Returns the size of this bounding box on the X axis.
      double getSizeY()
      Returns the size of this bounding box on the Y axis.
      double getSizeZ()
      Returns the size of this bounding box on the Z axis.
      Vector3d getUpperBound()
      Returns the upper bound of this bounding box.
      double getVolume()
      Returns the volume of this bounding box.
      boolean intersects​(AABB3d aabb)
      Returns true if this bounding box intersects the given bounding box.
      boolean isDegenerate()
      Returns true if the given bounding box is degenerated.
    • Method Detail

      • create

        static AABB3d create​(AABB3d boundingBox)
        Returns a new instance of 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 any dimension
        Since:
        9.10.2
      • create

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

        static AABB3d create​(Vector3d lowerBound,
                             Vector3d upperBound)
        Returns a bounding box with the given bounds. If lowerBound is greater than upperBound in any dimension, IllegalArgumentException is thrown. To construct bounding box from any set of opposing corners, create(Collection) should be used instead.
        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 any dimension
        Since:
        9.10.2
      • contains

        boolean contains​(Vector3d 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​(AABB3d 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

        MVector3d 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
      • distance

        double distance​(AABB3d box)
        Returns the minimum distance between this bounding box and the given bounding box.
        Parameters:
        box - the box to which the distance is computed
        Returns:
        the minimum distance between this bounding box and the given bounding box
        Since:
        9.10.2
      • distanceSquared

        double distanceSquared​(AABB3d box)
        Returns the square of the minimum distance between this bounding box and the given bounding box.
        Parameters:
        box - the box to which the squared distance is computed
        Returns:
        the square of the minimum distance between this bounding box and the given bounding box
        Since:
        9.10.2
      • getEdges

        Collection<Segment3d> getEdges()
        Returns the edges of this bounding box. The order is not specified.
        Returns:
        the edges of this bounding box
        Since:
        9.10.2
      • getLowerBound

        Vector3d 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
      • getSizeZ

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

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

        double getVolume()
        Returns the volume of this bounding box.
        Returns:
        the volume of this bounding box
        Since:
        9.10.2
      • intersects

        boolean intersects​(AABB3d aabb)
        Returns true if this bounding box intersects the given bounding box. Bounding boxes intersect if their boundaries intersect or if one is contained within the other.
        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 degenerated. A bounding box is considered degenerate if its volume is zero or if its lower bound is greater than its upper bound in any dimension.
        Returns:
        true if the given bounding box is degenerated
        Since:
        9.10.2