Class BoundingSphere


  • public class BoundingSphere
    extends java.lang.Object
    Represents a bounding sphere in Cartesian coordinates. Typically used as a bounding volume.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      Vec3 center
      The sphere's center point.
      double radius
      The sphere's radius.
    • Constructor Summary

      Constructors 
      Constructor Description
      BoundingSphere()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      int hashCode()  
      boolean intersectsFrustum​(Frustum frustum)
      Indicates whether this bounding sphere intersects a specified frustum.
      BoundingSphere set​(Vec3 center, double radius)
      Sets this bounding sphere to the specified center point and radius.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • center

        public final Vec3 center
        The sphere's center point.
      • radius

        public double radius
        The sphere's radius.
    • Constructor Detail

      • BoundingSphere

        public BoundingSphere()
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

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

        public BoundingSphere set​(Vec3 center,
                                  double radius)
        Sets this bounding sphere to the specified center point and radius.
        Parameters:
        center - the new center point
        radius - the new radius
        Returns:
        This bounding sphere with its center point and radius set to the specified values
        Throws:
        java.lang.IllegalArgumentException - If the center is null, or if the radius is negative
      • intersectsFrustum

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