com.jme.bounding
Interface BoundingVolume

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
BoundingBox, BoundingSphere, OBB2, OrientedBoundingBox, WidgetBoundingRectangle

public interface BoundingVolume
extends java.io.Serializable

BoundingVolume defines an interface for dealing with containment of a collection of points.

Version:
$Id: BoundingVolume.java,v 1.7 2004/09/10 22:36:11 mojomonkey Exp $
Author:
Mark Powell

Method Summary
 java.lang.Object clone(BoundingVolume store)
          clone creates a new BoundingVolume object containing the same data as this one.
 void computeFromPoints(Vector3f[] points)
          computeFromPoints generates a bounding volume that encompasses a collection of points.
 float distanceTo(Vector3f point)
          Find the distance from the center of this Bounding Volume to the given point.
 Vector3f getCenter(Vector3f store)
          This function stores the approximate center of the bounding volume into the store vector.
 int getCheckPlane(int index)
          get the value for a given index in the checkplanes
 void initCheckPlanes()
          initCheckPlanes resets the checkplanes to their standard order.
 boolean intersects(BoundingVolume bv)
          determines if this bounding volume and a second given volume are intersecting.
 boolean intersects(Ray ray)
          determines if a ray intersects this bounding volume.
 boolean intersectsBoundingBox(BoundingBox bb)
          determines if this bounding volume and a given bounding box are intersecting.
 boolean intersectsOBB2(OBB2 obb)
          determines if this bounding volume and a given oriented bounding box are intersecting.
 boolean intersectsOrientedBoundingBox(OrientedBoundingBox obb)
          determines if this bounding volume and a given oriented bounding box are intersecting.
 boolean intersectsSphere(BoundingSphere bs)
          determines if this bounding volume and a given bounding sphere are intersecting.
 BoundingVolume merge(BoundingVolume volume)
          merge combines two bounding volumes into a single bounding volume that contains both this bounding volume and the parameter volume.
 BoundingVolume mergeLocal(BoundingVolume volume)
          mergeLocal combines two bounding volumes into a single bounding volume that contains both this bounding volume and the parameter volume.
 void recomputeMesh()
          Reconstruct a visible mesh for the bound.
 void setCheckPlane(int index, int value)
          set the value for a given index in the checkplanes
 BoundingVolume transform(Quaternion rotate, Vector3f translate, Vector3f scale)
          transform alters the location of the bounding volume by a rotation, translation and a scalar.
 BoundingVolume transform(Quaternion rotate, Vector3f translate, Vector3f scale, BoundingVolume store)
          transform alters the location of the bounding volume by a rotation, translation and a scalar.
 int whichSide(Plane plane)
          whichSide returns the side on which the bounding volume lies on a plane.
 

Method Detail

transform

public BoundingVolume transform(Quaternion rotate,
                                Vector3f translate,
                                Vector3f scale)
transform alters the location of the bounding volume by a rotation, translation and a scalar.

Parameters:
rotate - the rotation to affect the bound.
translate - the translation to affect the bound.
scale - the scale to resize the bound.
Returns:
the new bounding volume.

transform

public BoundingVolume transform(Quaternion rotate,
                                Vector3f translate,
                                Vector3f scale,
                                BoundingVolume store)
transform alters the location of the bounding volume by a rotation, translation and a scalar.

Parameters:
rotate - the rotation to affect the bound.
translate - the translation to affect the bound.
scale - the scale to resize the bound.
store - sphere to store result in
Returns:
the new bounding volume.

whichSide

public int whichSide(Plane plane)
whichSide returns the side on which the bounding volume lies on a plane. Possible values are POSITIVE_SIDE, NEGATIVE_SIDE, and NO_SIDE.

Parameters:
plane - the plane to check against this bounding volume.
Returns:
the side on which this bounding volume lies.
See Also:
Point

computeFromPoints

public void computeFromPoints(Vector3f[] points)
computeFromPoints generates a bounding volume that encompasses a collection of points.

Parameters:
points - the points to contain.

merge

public BoundingVolume merge(BoundingVolume volume)
merge combines two bounding volumes into a single bounding volume that contains both this bounding volume and the parameter volume.

Parameters:
volume - the volume to combine.
Returns:
the new merged bounding volume.

mergeLocal

public BoundingVolume mergeLocal(BoundingVolume volume)
mergeLocal combines two bounding volumes into a single bounding volume that contains both this bounding volume and the parameter volume. The result is stored locally.

Parameters:
volume - the volume to combine.
Returns:
this

clone

public java.lang.Object clone(BoundingVolume store)
clone creates a new BoundingVolume object containing the same data as this one.

Parameters:
store - where to store the cloned information. if null or wrong class, a new store is created.
Returns:
the new BoundingVolume

initCheckPlanes

public void initCheckPlanes()
initCheckPlanes resets the checkplanes to their standard order.


getCheckPlane

public int getCheckPlane(int index)
get the value for a given index in the checkplanes

Parameters:
index -
Returns:

setCheckPlane

public void setCheckPlane(int index,
                          int value)
set the value for a given index in the checkplanes

Parameters:
index -
value -

recomputeMesh

public void recomputeMesh()
Reconstruct a visible mesh for the bound.


distanceTo

public float distanceTo(Vector3f point)
Find the distance from the center of this Bounding Volume to the given point.

Parameters:
point - The point to get the distance to
Returns:
distance

getCenter

public Vector3f getCenter(Vector3f store)
This function stores the approximate center of the bounding volume into the store vector. For easy function usage, the store vector should be returned when the function is complete.

Parameters:
store - The vector to store the center in.

intersects

public boolean intersects(BoundingVolume bv)
determines if this bounding volume and a second given volume are intersecting. Intersecting being: one volume contains another, one volume overlaps another or one volume touches another.

Parameters:
bv - the second volume to test against.
Returns:
true if this volume intersects the given volume.

intersects

public boolean intersects(Ray ray)
determines if a ray intersects this bounding volume.

Parameters:
ray - the ray to test.
Returns:
true if this volume is intersected by a given ray.

intersectsSphere

public boolean intersectsSphere(BoundingSphere bs)
determines if this bounding volume and a given bounding sphere are intersecting.

Parameters:
bs - the bounding sphere to test against.
Returns:
true if this volume intersects the given bounding sphere.

intersectsBoundingBox

public boolean intersectsBoundingBox(BoundingBox bb)
determines if this bounding volume and a given bounding box are intersecting.

Parameters:
bb - the bounding box to test against.
Returns:
true if this volume intersects the given bounding box.

intersectsOrientedBoundingBox

public boolean intersectsOrientedBoundingBox(OrientedBoundingBox obb)
determines if this bounding volume and a given oriented bounding box are intersecting.

Parameters:
obb - the bounding box to test against.
Returns:
true if this volume intersects the given oriented bounding box.

intersectsOBB2

public boolean intersectsOBB2(OBB2 obb)
determines if this bounding volume and a given oriented bounding box are intersecting.

Parameters:
obb - the bounding box to test against.
Returns:
true if this volume intersects the given oriented bounding box.