Class BoundingBox


  • public class BoundingBox
    extends java.lang.Object
    Represents a bounding box in Cartesian coordinates. Typically used as a bounding volume.
    • Constructor Summary

      Constructors 
      Constructor Description
      BoundingBox()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double distanceTo​(Vec3 point)  
      boolean intersectsFrustum​(Frustum frustum)
      Indicates whether this bounding box intersects a specified frustum.
      boolean isUnitBox()
      Indicates whether this bounding box is a unit box centered at the Cartesian origin (0, 0, 0).
      BoundingBox setToPoints​(float[] array, int count, int stride)
      Sets this bounding box such that it minimally encloses a specified array of points.
      BoundingBox setToSector​(Sector sector, Globe globe, float minHeight, float maxHeight)
      Sets this bounding box such that it contains a specified sector on a specified globe with min and max terrain height.
      BoundingBox setToUnitBox()
      Sets this bounding box to a unit box centered at the Cartesian origin (0, 0, 0).
      java.lang.String toString()  
      BoundingBox translate​(double x, double y, double z)
      Translates this bounding box by specified components.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • BoundingBox

        public BoundingBox()
    • Method Detail

      • toString

        @NonNull
        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • isUnitBox

        public boolean isUnitBox()
        Indicates whether this bounding box is a unit box centered at the Cartesian origin (0, 0, 0).
        Returns:
        true if this bounding box is a unit box, otherwise false
      • setToUnitBox

        public BoundingBox setToUnitBox()
        Sets this bounding box to a unit box centered at the Cartesian origin (0, 0, 0).
        Returns:
        This bounding box set to a unit box
      • setToPoints

        public BoundingBox setToPoints​(float[] array,
                                       int count,
                                       int stride)
        Sets this bounding box such that it minimally encloses a specified array of points.
        Parameters:
        array - the array of points to consider
        count - the number of array elements to consider
        stride - the number of coordinates between the first coordinate of adjacent points - must be at least 3
        Returns:
        This bounding box set to contain the specified array of points.
        Throws:
        java.lang.IllegalArgumentException - If the array is null or empty, if the count is less than 0, or if the stride is less than 3
      • setToSector

        public BoundingBox setToSector​(Sector sector,
                                       Globe globe,
                                       float minHeight,
                                       float maxHeight)
        Sets this bounding box such that it contains a specified sector on a specified globe with min and max terrain height.
        To create a bounding box that contains the sector at mean sea level, specify zero for the minimum and maximum height. To create a bounding box that contains the terrain surface in this sector, specify the actual minimum and maximum height values associated with the terrain in the sector, multiplied by the scene's vertical exaggeration.
        Parameters:
        sector - the sector for which to create the bounding box
        globe - the globe associated with the sector
        minHeight - the minimum terrain height within the sector
        maxHeight - the maximum terrain height within the sector
        Returns:
        this bounding box set to contain the specified sector
        Throws:
        java.lang.IllegalArgumentException - If any argument is null
      • translate

        public BoundingBox translate​(double x,
                                     double y,
                                     double z)
        Translates this bounding box by specified components.
        Parameters:
        x - the X translation component
        y - the Y translation component
        z - the Z translation component
        Returns:
        this bounding box translated by the specified components
      • distanceTo

        public double distanceTo​(Vec3 point)
      • intersectsFrustum

        public boolean intersectsFrustum​(Frustum frustum)
        Indicates whether this bounding box intersects a specified frustum.
        Parameters:
        frustum - The frustum of interest.
        Returns:
        true if the specified frustum intersects this bounding box, otherwise false.
        Throws:
        java.lang.IllegalArgumentException - If the specified frustum is null or undefined.