public class BoundingPolytope extends Bounds
Each plane in the BoundingPolytope specifies a half-space defined by the equation:
| Modifier and Type | Field and Description |
|---|---|
(package private) boolean |
allocBoxVerts |
(package private) Point3d[] |
boxVerts |
(package private) Point3d |
centroid |
(package private) double[] |
mag |
(package private) int |
nVerts |
(package private) double[] |
pDotN |
(package private) Vector4d[] |
planes
An array of bounding planes.
|
(package private) Point3d[] |
verts |
boundId, BOUNDING_BOX, BOUNDING_POLYTOPE, BOUNDING_SPHERE, boundsIsEmpty, boundsIsInfinite, debug, EPSILON| Constructor and Description |
|---|
BoundingPolytope()
Constructs a BoundingPolytope and initializes it to a set of 6
planes that defines a cube such that -1 <= x,y,z <= 1.
|
BoundingPolytope(Bounds boundsObject)
Constructs a BoundingPolytope from the specified bounds object.
|
BoundingPolytope(Bounds[] boundsObjects)
Constructs a BoundingPolytope from the specified array of bounds
objects.
|
BoundingPolytope(Vector4d[] planes)
Constructs a BoundingPolytope using the specified planes.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
checkBoundsIsEmpty() |
java.lang.Object |
clone()
Creates a copy of a polytope.
|
Bounds |
closestIntersection(Bounds[] boundsObjects)
Finds closest bounding object that intersects this bounding polytope.
|
void |
combine(Bounds boundsObject)
Combines this bounding polytope with a bounding object so that the
resulting bounding polytope encloses the original bounding polytope and the
given bounds object.
|
void |
combine(Bounds[] boundsObjects)
Combines this bounding polytope with an array of bounding objects so that the
resulting bounding polytope encloses the original bounding polytope and the
given array of bounds object.
|
void |
combine(Point3d point)
Combines this bounding polytope with a point.
|
void |
combine(Point3d[] points)
Combines this bounding polytope with an array of points.
|
private void |
computeAllVerts() |
private void |
computeVertex(int a,
int b,
int c) |
(package private) Bounds |
copy(Bounds r)
if the passed the "region" is same type as this object
then do a copy, otherwise clone the Bounds and
return
|
boolean |
equals(java.lang.Object bounds)
Indicates whether the specified
bounds object is
equal to this BoundingPolytope object. |
(package private) Point3d |
getCenter()
Returns the center of the bounds
|
int |
getNumPlanes() |
(package private) int |
getPickType() |
void |
getPlanes(Vector4d[] planes)
Returns the equations of the bounding planes for this bounding polytope.
|
int |
hashCode()
Returns a hash code value for this BoundingPolytope object
based on the data values in this object.
|
private void |
initEmptyPolytope() |
boolean |
intersect(Bounds boundsObject)
Test for intersection with another bounds object.
|
boolean |
intersect(Bounds[] boundsObjects)
Test for intersection with another bounds object.
|
boolean |
intersect(Bounds[] boundsObjects,
BoundingPolytope newBoundingPolytope)
Test for intersection with an array of bounds objects.
|
boolean |
intersect(Bounds boundsObject,
BoundingPolytope newBoundPolytope)
Test for intersection with another bounds object.
|
(package private) boolean |
intersect(Bounds boundsObject,
Point4d position)
Test for intersection with another bounds object.
|
boolean |
intersect(Point3d point)
Test for intersection with a point.
|
(package private) boolean |
intersect(Point3d start,
Point3d end,
Point4d position)
Test for intersection with a segment
|
(package private) boolean |
intersect(Point3d point,
Point4d position)
Test for intersection with a point
|
boolean |
intersect(Point3d origin,
Vector3d direction)
Test for intersection with a ray.
|
(package private) boolean |
intersect(Point3d origin,
Vector3d direction,
Point3d intersectPoint)
Test for intersection with a ray.
|
(package private) boolean |
intersect(Point3d origin,
Vector3d direction,
Point4d position)
Test for intersection with a ray
|
boolean |
isEmpty()
Tests whether the bounding polytope is empty.
|
private boolean |
pointInPolytope(double x,
double y,
double z) |
void |
set(Bounds boundsObject)
Sets the planes for this BoundingPolytope by keeping its current
number and position of planes and computing new planes positions
to enclose the given bounds object.
|
void |
setPlanes(Vector4d[] planes)
Sets the bounding planes for this polytope.
|
java.lang.String |
toString()
Returns a string representation of this class
|
void |
transform(Bounds boundsObject,
Transform3D matrix)
Modifies the bounding polytope so that it bounds the volume
generated by transforming the given bounding object.
|
void |
transform(Transform3D matrix)
Transforms this bounding polytope by the given transformation matrix.
|
closest_point, getWithLock, intersect_ptope_abox, intersect_ptope_ptope, intersect_ptope_sphere, setWithLockVector4d[] planes
double[] mag
double[] pDotN
Point3d[] verts
int nVerts
Point3d centroid
Point3d[] boxVerts
boolean allocBoxVerts
public BoundingPolytope(Vector4d[] planes)
planes - a set of planes defining the polytope.java.lang.IllegalArgumentException - if the length of the
specified array of planes is less than 4.public BoundingPolytope()
public BoundingPolytope(Bounds boundsObject)
boundsObject - the bounds object from which this polytope
is constructed.public BoundingPolytope(Bounds[] boundsObjects)
boundsObjects - the array bounds objects from which this
polytope is constructed.public void setPlanes(Vector4d[] planes)
planes - the new set of planes for this polytopejava.lang.IllegalArgumentException - if the length of the
specified array of planes is less than 4.public void getPlanes(Vector4d[] planes)
planes - an array Vector4d to receive the bounding planespublic int getNumPlanes()
public void set(Bounds boundsObject)
public java.lang.Object clone()
public boolean equals(java.lang.Object bounds)
bounds object is
equal to this BoundingPolytope object. They are equal if the
specified bounds object is an instance of
BoundingPolytope and all of the data
members of bounds are equal to the corresponding
data members in this BoundingPolytope.public int hashCode()
public void combine(Bounds boundsObject)
public void combine(Bounds[] boundsObjects)
public void combine(Point3d point)
public void combine(Point3d[] points)
public void transform(Bounds boundsObject, Transform3D matrix)
public void transform(Transform3D matrix)
boolean intersect(Point3d origin, Vector3d direction, Point3d intersectPoint)
origin - is a the starting point of the raydirection - is the direction of the rayintersectPoint - is a point defining the location of the intersectionboolean intersect(Point3d origin, Vector3d direction, Point4d position)
boolean intersect(Point3d start, Point3d end, Point4d position)
public boolean intersect(Point3d origin, Vector3d direction)
public boolean isEmpty()
public boolean intersect(Point3d point)
boolean intersect(Bounds boundsObject, Point4d position)
public boolean intersect(Bounds boundsObject)
public boolean intersect(Bounds[] boundsObjects)
public boolean intersect(Bounds boundsObject, BoundingPolytope newBoundPolytope)
boundsObject - another bounds objectnewBoundPolytope - the new bounding polytope, which is the intersection of
the boundsObject and this BoundingPolytopepublic boolean intersect(Bounds[] boundsObjects, BoundingPolytope newBoundingPolytope)
boundsObjects - an array of bounds objectsnewBoundingPolytope - the new bounding polytope, which is the intersection of
the boundsObject and this BoundingPolytopepublic Bounds closestIntersection(Bounds[] boundsObjects)
closestIntersection in class BoundsboundsObjects - is an array of bounds objectspublic java.lang.String toString()
toString in class java.lang.Objectprivate void computeVertex(int a,
int b,
int c)
private void computeAllVerts()
private boolean pointInPolytope(double x,
double y,
double z)
private void checkBoundsIsEmpty()
private void initEmptyPolytope()
Point3d getCenter()
BoundsBounds copy(Bounds r)
int getPickType()
getPickType in class BoundsCopyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.