Class SphereBV

    • Field Detail

      • m_kSphere

        protected Sphere3f m_kSphere
        Sphere in this bounding volume:
    • Constructor Detail

      • SphereBV

        public SphereBV()
        Default construction. Set sphere center (0,0,0), radius 0.
      • SphereBV

        public SphereBV​(Sphere3f rkSphere)
        Set constructor
        Parameters:
        rkSphere - sphere to copy into this.
    • Method Detail

      • ComputeFromData

        public void ComputeFromData​(Vector3f[] pkVertices)
        Compute a sphere that contains all the points.
        Specified by:
        ComputeFromData in class BoundingVolume
        Parameters:
        pkVertices - points to contain.
      • ComputeFromData

        public void ComputeFromData​(VertexBuffer pkVBuffer)
        Compute a sphere that contains all the points in the VertexBuffer.
        Specified by:
        ComputeFromData in class BoundingVolume
        Parameters:
        pkVBuffer - VertexBuffer with points to contain.
      • Contains

        public boolean Contains​(Vector3f rkPoint)
        Test for containment of a point
        Specified by:
        Contains in class BoundingVolume
        Parameters:
        rkPoint - point to test.
        Returns:
        true if contained in bounding volume.
      • CopyFrom

        public void CopyFrom​(BoundingVolume pkInput)
        Make a copy of the bounding volume.
        Specified by:
        CopyFrom in class BoundingVolume
        Parameters:
        pkInput - bounding volume to copy.
      • GetCenter

        public final Vector3f GetCenter()
        All bounding volumes must define a center and radius
        Specified by:
        GetCenter in class BoundingVolume
        Returns:
        bounding volume center.
      • GetDiskUsed

        public int GetDiskUsed​(StreamVersion rkVersion)
        Returns the size of this object and it's children on disk for the current StreamVersion parameter.
        Specified by:
        GetDiskUsed in interface StreamInterface
        Overrides:
        GetDiskUsed in class BoundingVolume
        Parameters:
        rkVersion - the current version of the Stream file being created.
        Returns:
        the size of this object on disk.
      • GetRadius

        public final float GetRadius()
        All bounding volumes must define a center and radius
        Specified by:
        GetRadius in class BoundingVolume
        Returns:
        bounding volume radius.
      • GetSphere

        public final Sphere3f GetSphere()
        Return bounding volume sphere object.
        Returns:
        bounding volume sphere object.
      • GrowToContain

        public void GrowToContain​(BoundingVolume pkInput)
        Change the current sphere so that it is the minimum volume sphere that contains the input sphere as well as its old sphere.
        Specified by:
        GrowToContain in class BoundingVolume
        Parameters:
        pkInput - bounding volume to contain.
      • Link

        public void Link​(Stream rkStream,
                         Stream.Link pkLink)
        Copies this objects children objects from the input Stream's HashTable, based on the LinkID of the child stored in the pkLink parameter.
        Specified by:
        Link in interface StreamInterface
        Overrides:
        Link in class BoundingVolume
        Parameters:
        rkStream - the Stream where the child objects are stored.
        pkLink - the Link class from which the child object IDs are read.
      • Load

        public void Load​(Stream rkStream,
                         Stream.Link pkLink)
        Loads this object from the input parameter rkStream, using the input Stream.Link to store the IDs of children objects of this object for linking after all objects are loaded from the Stream.
        Specified by:
        Load in interface StreamInterface
        Overrides:
        Load in class BoundingVolume
        Parameters:
        rkStream - the Stream from which this object is being read.
        pkLink - the Link class for storing the IDs of this object's children objects.
      • Register

        public boolean Register​(Stream rkStream)
        Registers this object with the input Stream parameter. All objects streamed to disk are registered with the Stream so that a unique list of objects is maintained.
        Specified by:
        Register in interface StreamInterface
        Overrides:
        Register in class BoundingVolume
        Parameters:
        rkStream - the Stream where the child objects are stored.
        Returns:
        true if this object is registered, false if the object has already been registered.
      • Save

        public void Save​(Stream rkStream)
        Write this object and all it's children to the Stream.
        Specified by:
        Save in interface StreamInterface
        Overrides:
        Save in class BoundingVolume
        Parameters:
        rkStream - the Stream where the child objects are stored.
      • SaveStrings

        public StringTree SaveStrings​(java.lang.String acTitle)
        Write this object into a StringTree for the scene-graph visualization.
        Specified by:
        SaveStrings in interface StreamInterface
        Overrides:
        SaveStrings in class BoundingVolume
        Parameters:
        acTitle - the header for this object in the StringTree.
        Returns:
        StringTree containing a String-based representation of this object and it's children.
      • SetCenter

        public final void SetCenter​(Vector3f rkCenter)
        All bounding volumes must define a center and radius
        Specified by:
        SetCenter in class BoundingVolume
        Parameters:
        rkCenter - bounding volume center.
      • SetRadius

        public final void SetRadius​(float fRadius)
        All bounding volumes must define a center and radius
        Specified by:
        SetRadius in class BoundingVolume
        Parameters:
        fRadius - bounding volume radius.
      • Sphere

        public final Sphere3f Sphere()
        Return bounding volume sphere object.
        Returns:
        bounding volume sphere object.
      • TestIntersection

        public boolean TestIntersection​(BoundingVolume pkInput)
        Test for intersection of the two bounds.
        Specified by:
        TestIntersection in class BoundingVolume
        Parameters:
        pkInput - bounding volume to test.
        Returns:
        true if this bounding volume intersects the input.
      • TestIntersection

        public boolean TestIntersection​(Vector3f rkOrigin,
                                        Vector3f rkDirection,
                                        float fTMin,
                                        float fTMax)
        Test for intersection of linear component and bound (points of intersection not computed). The linear component is parameterized by P + t*D, where P is a point on the component and D is a unit-length direction. The interval [tmin,tmax] is line: tmin = -Mathf::MAX_REAL, tmax = Mathf::MAX_REAL ray: tmin = 0.0f, tmax = Mathf::MAX_REAL segment: tmin = 0.0f, tmax > 0.0f
        Specified by:
        TestIntersection in class BoundingVolume
        Parameters:
        rkOrigin - origin.
        rkDirection - direction.
        fTMin - parameter t min-value.
        fTMax - parameter t max-value.
        Returns:
        true if intersection, false otherwise.
      • TransformBy

        public void TransformBy​(Transformation rkTransform,
                                BoundingVolume pkResult)
        Transform the sphere (model-to-world conversion).
        Specified by:
        TransformBy in class BoundingVolume
        Parameters:
        rkTransform - transformation for sphere.
        pkResult - bounding volume result.
      • WhichSide

        public int WhichSide​(Plane3f rkPlane)
        Determine if the bounding volume is one side of the plane, the other side, or straddles the plane. If it is on the positive side (the side to which the normal points), the return value is +1. If it is on the negative side, the return value is -1. If it straddles the plane, the return value is 0.
        Specified by:
        WhichSide in class BoundingVolume
        Parameters:
        rkPlane - plane to test against bounding volume.
        Returns:
        positive: +1; negative: -1; straddles: 0.