Class BoundingVolume

    • Constructor Detail

      • BoundingVolume

        public BoundingVolume()
        streaming constructor.
    • Method Detail

      • ComputeFromData

        public abstract void ComputeFromData​(Vector3f[] pkVertices)
        Compute a bounding volume that contains all the points.
        Parameters:
        pkVertices - array of points.
      • ComputeFromData

        public abstract void ComputeFromData​(VertexBuffer pkVBuffer)
        Compute a bounding volume that contains all the points.
        Parameters:
        pkVBuffer - VertexBuffer containing points.
      • Contains

        public abstract boolean Contains​(Vector3f rkPoint)
        test for containment of a point
        Parameters:
        rkPoint - point to test.
        Returns:
        true if contained in this volume..
      • CopyFrom

        public abstract void CopyFrom​(BoundingVolume pkInput)
        Make a copy of the bounding volume.
        Parameters:
        pkInput - bounding volume to copy into this.
      • GetCenter

        public abstract Vector3f GetCenter()
        all bounding volumes must define a center and radius
        Returns:
        center of bounding volume.
      • 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 GraphicsObject
        Parameters:
        rkVersion - the current version of the Stream file being created.
        Returns:
        the size of this object on disk.
      • GetRadius

        public abstract float GetRadius()
        all bounding volumes must define a center and radius
        Returns:
        radius of bounding volume.
      • GrowToContain

        public abstract void GrowToContain​(BoundingVolume pkInput)
        Change the current bounding volume so that it contains the input bounding volume as well as its old bounding volume.
        Parameters:
        pkInput - bounding volume to grow and contain with.
      • 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 GraphicsObject
        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 GraphicsObject
        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 GraphicsObject
        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 GraphicsObject
        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 GraphicsObject
        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 abstract void SetCenter​(Vector3f rkCenter)
        all bounding volumes must define a center and radius
        Parameters:
        rkCenter - center of bounding volume.
      • SetRadius

        public abstract void SetRadius​(float fRadius)
        all bounding volumes must define a center and radius
        Parameters:
        fRadius - radius of bounding volume.
      • TestIntersection

        public abstract boolean TestIntersection​(BoundingVolume pkInput)
        Test for intersection of the two bounds.
        Parameters:
        pkInput - BoundingVolume.
        Returns:
        true if intersects.
      • TestIntersection

        public abstract 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
        Parameters:
        rkOrigin - origin of point.
        rkDirection - unit-length direction.
        fTMin - min value for parameter t.
        fTMax - miax value for parameter t.
        Returns:
        true if intersects.
      • TransformBy

        public abstract void TransformBy​(Transformation rkTransform,
                                         BoundingVolume pkResult)
        Transform the bounding volume (model-to-world conversion).
        Parameters:
        rkTransform - transformation
        pkResult - updated bounding volume.
      • WhichSide

        public abstract 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.
        Parameters:
        rkPlane - plane to test against bounding volume.
        Returns:
        positive side: +1; negative side: -1; straddle: 0.