javax.media.j3d
Class BoundingBox

java.lang.Object
  |
  +--javax.media.j3d.Bounds
        |
        +--javax.media.j3d.BoundingBox

public class BoundingBox
extends Bounds

This class defines an axis aligned bounding box which is used for bounding regions.


Constructor Summary
BoundingBox()
          Constructs and initializes a cube where -1 <= x,y,z <= 1.
BoundingBox(Bounds boundsObject)
          Constructs a BoundingBox from a bounding object.
BoundingBox(Bounds[] bounds)
          Constructs a BoundingBox from an array of bounding objects.
BoundingBox(Point3d lower, Point3d upper)
          Constructs and initializes a BoundingBox given min,max in x,y,z.
 
Method Summary
 java.lang.Object clone()
          Creates a copy of this bounding box.
 Bounds closestIntersection(Bounds[] boundsObjects)
          Finds closest bounding object which intersects this bounding box
 void combine(Bounds boundsObject)
          Combines this bounding box with a bounding object so that the resulting bounding box encloses the original bounding box and the specified bounds object.
 void combine(Bounds[] bounds)
          Combines this bounding box with an array of bounding objects so that the resulting bounding box encloses the original bounding box and the array of bounding objects.
 void combine(Point3d point)
          Combines this bounding box with a point so that the resulting bounding box encloses the original bounding box and the point.
 void combine(Point3d[] points)
          Combines this bounding box with an array of points so that the resulting bounding box encloses the original bounding box and the array of points.
 void getLower(Point3d p1)
          Gets the lower corner of this bounding box.
 void getUpper(Point3d p1)
          Gets the upper corner of this bounding box.
 boolean intersect(Bounds boundsObject)
          Test for intersection with another bounds object
 boolean intersect(Bounds[] boundsObjects)
          Test for intersection with an array of bounds objects
 boolean intersect(Bounds[] boundsObjects, BoundingBox newBoundBox)
          Test for intersection with an array of bounds objects
 boolean intersect(Bounds boundsObject, BoundingBox newBoundBox)
          Test for intersection with another bounding box
 boolean intersect(Point3d point)
          Test for intersection with a point
 boolean intersect(Point3d origin, Vector3d direction)
          Test for intersection with a ray
 boolean isEmpty()
          Tests whether the bounding box is empty.
 void set(Bounds boundsObject)
          Sets the the value of this BoundingBox
 void setLower(double xmin, double ymin, double zmin)
          Sets the lower corner of this bounding box.
 void setLower(Point3d p1)
          Sets the lower corner of this bounding box.
 void setUpper(double xmax, double ymax, double zmax)
          Sets the upper corner of this bounding box.
 void setUpper(Point3d p1)
          Sets the upper corner of this bounding box.
 java.lang.String toString()
          Returns a string representation of this class
 void transform(Bounds boundsObject, Transform3D matrix)
          Modifies the bounding box so that it bounds the volume generated by transforming the given bounding object.
 void transform(Transform3D matrix)
          Transforms this bounding box by the given matrix
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BoundingBox

public BoundingBox(Point3d lower,
                   Point3d upper)
Constructs and initializes a BoundingBox given min,max in x,y,z.
Parameters:
lower - the "small" corner
upper - the "large" corner

BoundingBox

public BoundingBox()
Constructs and initializes a cube where -1 <= x,y,z <= 1.

BoundingBox

public BoundingBox(Bounds boundsObject)
Constructs a BoundingBox from a bounding object.
Parameters:
boundsObject - is a bounds object

BoundingBox

public BoundingBox(Bounds[] bounds)
Constructs a BoundingBox from an array of bounding objects.
Parameters:
bounds - an array of bounding objects
Method Detail

getLower

public void getLower(Point3d p1)
Gets the lower corner of this bounding box.
Parameters:
p1 - a Point to receive the lower corner of the bounding box

setLower

public void setLower(double xmin,
                     double ymin,
                     double zmin)
Sets the lower corner of this bounding box.
Parameters:
xmin - minimum x value of boundining box
ymin - minimum y value of boundining box
zmin - minimum z value of boundining box

setLower

public void setLower(Point3d p1)
Sets the lower corner of this bounding box.
Parameters:
p1 - a Point defining the new lower corner of the bounding box

getUpper

public void getUpper(Point3d p1)
Gets the upper corner of this bounding box.
Parameters:
p1 - a Point to receive the upper corner of the bounding box

setUpper

public void setUpper(double xmax,
                     double ymax,
                     double zmax)
Sets the upper corner of this bounding box.
Parameters:
xmax - max x value of boundining box
ymax - max y value of boundining box
zmax - max z value of boundining box

setUpper

public void setUpper(Point3d p1)
Sets the upper corner of this bounding box.
Parameters:
p1 - a Point defining the new upper corner of the bounding box

set

public void set(Bounds boundsObject)
Sets the the value of this BoundingBox
Overrides:
set in class Bounds
Parameters:
boundsObject - is another bounds object

clone

public java.lang.Object clone()
Creates a copy of this bounding box.
Overrides:
clone in class Bounds
Returns:
a new bounding box

combine

public void combine(Bounds boundsObject)
Combines this bounding box with a bounding object so that the resulting bounding box encloses the original bounding box and the specified bounds object.
Overrides:
combine in class Bounds
Parameters:
boundsObject - is another bounds object

combine

public void combine(Bounds[] bounds)
Combines this bounding box with an array of bounding objects so that the resulting bounding box encloses the original bounding box and the array of bounding objects.
Overrides:
combine in class Bounds
Parameters:
boundsObjects - is an array of bounds objects

combine

public void combine(Point3d point)
Combines this bounding box with a point so that the resulting bounding box encloses the original bounding box and the point.
Overrides:
combine in class Bounds
Parameters:
point - is a 3d point in space

combine

public void combine(Point3d[] points)
Combines this bounding box with an array of points so that the resulting bounding box encloses the original bounding box and the array of points.
Overrides:
combine in class Bounds
Parameters:
points - is an array of 3d points in space

transform

public void transform(Bounds boundsObject,
                      Transform3D matrix)
Modifies the bounding box so that it bounds the volume generated by transforming the given bounding object.
Overrides:
transform in class Bounds
Parameters:
boundsObject - is the bounding object to be transformed
matrix - is a transformation matrix

transform

public void transform(Transform3D matrix)
Transforms this bounding box by the given matrix
Overrides:
transform in class Bounds
Parameters:
matrix - is a transformation matrix

intersect

public boolean intersect(Point3d origin,
                         Vector3d direction)
Test for intersection with a ray
Overrides:
intersect in class Bounds
Returns:
true or false indicating if an intersection occured

intersect

public boolean intersect(Point3d point)
Test for intersection with a point
Overrides:
intersect in class Bounds
Parameters:
point - is a point defining a position in 3-space
Returns:
true or false indicating if an intersection occured

isEmpty

public boolean isEmpty()
Tests whether the bounding box is empty. A bounding box is empty if it is null (either by construction or as the result of a null intersection) or if its volume is negative. A bounding box with a volume of zero is not empty.
Overrides:
isEmpty in class Bounds
Returns:
true if the bounding box is empty; otherwise, it returns false

intersect

public boolean intersect(Bounds boundsObject)
Test for intersection with another bounds object
Overrides:
intersect in class Bounds
Parameters:
boundsObject - is another bounds object
Returns:
true or false indicating if an intersection occured

intersect

public boolean intersect(Bounds[] boundsObjects)
Test for intersection with an array of bounds objects
Overrides:
intersect in class Bounds
Parameters:
boundsObjects - is an array of bounding objects
Returns:
true or false indicating if an intersection occured

intersect

public boolean intersect(Bounds boundsObject,
                         BoundingBox newBoundBox)
Test for intersection with another bounding box
Parameters:
boundsObject - is another bounding object
newBoundBox - is the new bounding box which is the intersection of the boundsObject and this BoundingBox
Returns:
true or false indicating if an intersection occured

intersect

public boolean intersect(Bounds[] boundsObjects,
                         BoundingBox newBoundBox)
Test for intersection with an array of bounds objects
Parameters:
boundsObjects - is an array of bounds objects
newBoundBox - is the new bounding box which is the intersection of the boundsObject and this BoundingBox
Returns:
true or false indicating if an intersection occured

closestIntersection

public Bounds closestIntersection(Bounds[] boundsObjects)
Finds closest bounding object which intersects this bounding box
Overrides:
closestIntersection in class Bounds
Parameters:
boundsObjects - is an array of bounds objects
Returns:
closest bounding object

toString

public java.lang.String toString()
Returns a string representation of this class
Overrides:
toString in class java.lang.Object