Package javax.media.j3d
Class BoundingBox
- java.lang.Object
-
- javax.media.j3d.Bounds
-
- javax.media.j3d.BoundingBox
-
- All Implemented Interfaces:
java.lang.Cloneable
public class BoundingBox extends Bounds
This class defines an axis aligned bounding box which is used for bounding regions.
-
-
Constructor Summary
Constructors Constructor Description BoundingBox()Constructs and initializes a 2X bounding box about the origin.BoundingBox(Bounds boundsObject)Constructs a BoundingBox from a bounding object.BoundingBox(Bounds[] bounds)Constructs a BoundingBox from an array of bounding objects.BoundingBox(javax.vecmath.Point3d lower, javax.vecmath.Point3d upper)Constructs and initializes a BoundingBox given min,max in x,y,z.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()Creates a copy of this bounding box.BoundsclosestIntersection(Bounds[] boundsObjects)Finds closest bounding object that intersects this bounding box.voidcombine(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.voidcombine(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.voidcombine(javax.vecmath.Point3d point)Combines this bounding box with a point so that the resulting bounding box encloses the original bounding box and the point.voidcombine(javax.vecmath.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.booleanequals(java.lang.Object bounds)Indicates whether the specifiedboundsobject is equal to this BoundingBox object.voidgetLower(javax.vecmath.Point3d p1)Gets the lower corner of this bounding box.voidgetUpper(javax.vecmath.Point3d p1)Gets the upper corner of this bounding box.inthashCode()Returns a hash code value for this BoundingBox object based on the data values in this object.booleanintersect(Bounds boundsObject)Test for intersection with another bounds object.booleanintersect(Bounds[] boundsObjects)Test for intersection with an array of bounds objects.booleanintersect(Bounds[] boundsObjects, BoundingBox newBoundBox)Test for intersection with an array of bounds objects.booleanintersect(Bounds boundsObject, BoundingBox newBoundBox)Test for intersection with another bounding box.booleanintersect(javax.vecmath.Point3d point)Test for intersection with a point.booleanintersect(javax.vecmath.Point3d origin, javax.vecmath.Vector3d direction)Test for intersection with a ray.booleanisEmpty()Tests whether the bounding box is empty.voidset(Bounds boundsObject)Sets the the value of this BoundingBoxvoidsetLower(double xmin, double ymin, double zmin)Sets the lower corner of this bounding box.voidsetLower(javax.vecmath.Point3d p1)Sets the lower corner of this bounding box.voidsetUpper(double xmax, double ymax, double zmax)Sets the upper corner of this bounding box.voidsetUpper(javax.vecmath.Point3d p1)Sets the upper corner of this bounding box.java.lang.StringtoString()Returns a string representation of this class.voidtransform(Bounds boundsObject, Transform3D matrix)Modifies the bounding box so that it bounds the volume generated by transforming the given bounding object.voidtransform(Transform3D matrix)Transforms this bounding box by the given matrix.
-
-
-
Constructor Detail
-
BoundingBox
public BoundingBox(javax.vecmath.Point3d lower, javax.vecmath.Point3d upper)Constructs and initializes a BoundingBox given min,max in x,y,z.- Parameters:
lower- the "small" cornerupper- the "large" corner
-
BoundingBox
public BoundingBox()
Constructs and initializes a 2X bounding box about the origin. The lower corner is initialized to (-1.0d, -1.0d, -1.0d) and the opper corner is initialized to (1.0d, 1.0d, 1.0d).
-
BoundingBox
public BoundingBox(Bounds boundsObject)
Constructs a BoundingBox from a bounding object.- Parameters:
boundsObject- 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(javax.vecmath.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 boxymin- minimum y value of boundining boxzmin- minimum z value of boundining box
-
setLower
public void setLower(javax.vecmath.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(javax.vecmath.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 boxymax- max y value of boundining boxzmax- max z value of boundining box
-
setUpper
public void setUpper(javax.vecmath.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
-
clone
public java.lang.Object clone()
Creates a copy of this bounding box.
-
equals
public boolean equals(java.lang.Object bounds)
Indicates whether the specifiedboundsobject is equal to this BoundingBox object. They are equal if the specifiedboundsobject is an instance of BoundingBox and all of the data members ofboundsare equal to the corresponding data members in this BoundingBox.
-
hashCode
public int hashCode()
Returns a hash code value for this BoundingBox object based on the data values in this object. Two different BoundingBox objects with identical data values (i.e., BoundingBox.equals returns true) will return the same hash code value. Two BoundingBox objects with different data members may return the same hash code value, although this is not likely.
-
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.
-
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.
-
combine
public void combine(javax.vecmath.Point3d point)
Combines this bounding box with a point so that the resulting bounding box encloses the original bounding box and the point.
-
combine
public void combine(javax.vecmath.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.
-
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.
-
transform
public void transform(Transform3D matrix)
Transforms this bounding box by the given matrix.
-
intersect
public boolean intersect(javax.vecmath.Point3d origin, javax.vecmath.Vector3d direction)Test for intersection with a ray.
-
intersect
public boolean intersect(javax.vecmath.Point3d point)
Test for intersection with a point.
-
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.
-
intersect
public boolean intersect(Bounds boundsObject)
Test for intersection with another bounds object.
-
intersect
public boolean intersect(Bounds[] boundsObjects)
Test for intersection with an array of bounds objects.
-
intersect
public boolean intersect(Bounds boundsObject, BoundingBox newBoundBox)
Test for intersection with another bounding box.- Parameters:
boundsObject- another bounding objectnewBoundBox- 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- an array of bounds objectsnewBoundBox- 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 that intersects this bounding box.- Specified by:
closestIntersectionin classBounds- Parameters:
boundsObjects- an array of bounds objects- Returns:
- closest bounding object
-
toString
public java.lang.String toString()
Returns a string representation of this class.- Overrides:
toStringin classjava.lang.Object
-
-