jme.geometry.bounding
Class BoundingBox

java.lang.Object
  extended byjme.geometry.bounding.BoundingBox
All Implemented Interfaces:
BoundingVolume

public class BoundingBox
extends java.lang.Object
implements BoundingVolume

BoundingBox defines a bounding volume that contains all vertices that make up the geometry.

Version:
$Id: BoundingBox.java,v 1.6 2003/09/08 20:29:28 mojomonkey Exp $
Author:
Mark Powell

Constructor Summary
BoundingBox()
          Default constructor instantiates a new BoundingBox object with default (0,0,0) vectors.
BoundingBox(Vector center, Vector minPoint, Vector maxPoint)
          Constructor creates a new BoundingBox object with the defined attributes.
 
Method Summary
 void axisAligned(Vector[] points)
          axisAligned creates a minimal box around all supplied points.
 float distance(BoundingVolume volume)
           
 Vector getCenter()
          getCenter returns the center (in relation to the parent entity) of the bounding box.
 Vector getMaxPoint()
          getMaxPoint returns the maxPoint of maximum point of the box.
 Vector getMinPoint()
          getMinPoint returns the minPoint or minimum point of the bounding box.
 boolean hasCollision(BoundingVolume volume)
           
 boolean isVisible(Frustum frustum)
           
 void setCenter(Vector center)
          setCenter sets the center of the bounding box.
 void setMaxPoint(Vector maxPoint)
          setMaxPoint sets the new maximum point of the box.
 void setMinPoint(Vector minPoint)
          setMinPoint sets the minPoint or maximum point of the bounding box.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BoundingBox

public BoundingBox()
Default constructor instantiates a new BoundingBox object with default (0,0,0) vectors.


BoundingBox

public BoundingBox(Vector center,
                   Vector minPoint,
                   Vector maxPoint)
Constructor creates a new BoundingBox object with the defined attributes.

Parameters:
center - the center of the box.
minPoint - the minimum point of the box.
maxPoint - the maximum point of the box.
Method Detail

axisAligned

public void axisAligned(Vector[] points)
axisAligned creates a minimal box around all supplied points. The orientation is always aligned with the local entity's coordinate system and therefore is axis aligned.

Parameters:
points - the list of points to contain.

getMinPoint

public Vector getMinPoint()
getMinPoint returns the minPoint or minimum point of the bounding box.

Returns:
the minPoint point of the box.

setMinPoint

public void setMinPoint(Vector minPoint)
setMinPoint sets the minPoint or maximum point of the bounding box.

Parameters:
minPoint - the new minPoint point of the box.

getCenter

public Vector getCenter()
getCenter returns the center (in relation to the parent entity) of the bounding box.

Returns:
the center of the bounding box.

setCenter

public void setCenter(Vector center)
setCenter sets the center of the bounding box.

Parameters:
center - the new center of the bounding box.

getMaxPoint

public Vector getMaxPoint()
getMaxPoint returns the maxPoint of maximum point of the box.

Returns:
the maxPoint of the box.

setMaxPoint

public void setMaxPoint(Vector maxPoint)
setMaxPoint sets the new maximum point of the box.

Parameters:
maxPoint - the new maxPoint of the box.

hasCollision

public boolean hasCollision(BoundingVolume volume)
Specified by:
hasCollision in interface BoundingVolume

distance

public float distance(BoundingVolume volume)
Specified by:
distance in interface BoundingVolume

isVisible

public boolean isVisible(Frustum frustum)
Specified by:
isVisible in interface BoundingVolume