javax.media.j3d
Class BoundingPolytope

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

public class BoundingPolytope
extends Bounds

This class defines a set of planes which describe a convex, closed polygonal bounding region.


Constructor Summary
BoundingPolytope()
          Constructs a BoundingPolytope and initializes it to a cube where -1 <= x,y,z <= 1
BoundingPolytope(Bounds boundsObject)
          Constructs a BoundingPolytope from a bounds object.
BoundingPolytope(Bounds[] boundsObjects)
          Constructs a BoundingPolytope from an array of bounds objects.
BoundingPolytope(Vector4d[] planes)
          Constructs and initializes a BoundingPolytope from an array of bounding planes.
 
Method Summary
 java.lang.Object clone()
          Creates a copy of a polytope
 Bounds closestIntersection(Bounds[] boundsObjects)
          Finds closest bounding object which 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
 int getNumPlanes()
           
 void getPlanes(Vector4d[] planes)
          Returns the equations of the bounding planes for this bounding polytope
 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
 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 polytope is empty.
 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)
          This transforms this bounding polytope by the given transformation matrix
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BoundingPolytope

public BoundingPolytope(Vector4d[] planes)
Constructs and initializes a BoundingPolytope from an array of bounding planes.
Parameters:
planes - a set of planes defining the polytope

BoundingPolytope

public BoundingPolytope()
Constructs a BoundingPolytope and initializes it to a cube where -1 <= x,y,z <= 1

BoundingPolytope

public BoundingPolytope(Bounds boundsObject)
Constructs a BoundingPolytope from a bounds object.

BoundingPolytope

public BoundingPolytope(Bounds[] boundsObjects)
Constructs a BoundingPolytope from an array of bounds objects.
Method Detail

setPlanes

public void setPlanes(Vector4d[] planes)
Sets the bounding planes for this polytope.
Parameters:
planes - the new set of planes for this polytope

getPlanes

public void getPlanes(Vector4d[] planes)
Returns the equations of the bounding planes for this bounding polytope
Parameters:
planes - an array Vector4d to receive the bounding planes

getNumPlanes

public int getNumPlanes()

set

public 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.
Overrides:
set in class Bounds
Parameters:
boundsObject - is another bounds object

clone

public java.lang.Object clone()
Creates a copy of a polytope
Overrides:
clone in class Bounds
Returns:
a new BoundingPolytope

combine

public 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
Overrides:
combine in class Bounds
Parameters:
boundsObject - is another bounds object

combine

public 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
Overrides:
combine in class Bounds
Parameters:
boundsObjects - is an array of bounds objects

combine

public void combine(Point3d point)
Combines this bounding polytope with a point
Overrides:
combine in class Bounds
Parameters:
point - is a 3d point in space

combine

public void combine(Point3d[] points)
Combines this bounding polytope with an 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 polytope 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)
This transforms this bounding polytope by the given transformation 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

isEmpty

public boolean isEmpty()
Tests whether the bounding polytope is empty. A bounding polytope 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 polytope with a volume of zero is not empty.
Overrides:
isEmpty in class Bounds
Returns:
true if the bounding polytope is empty; otherwise, it returns false

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

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 another bounds object
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,
                         BoundingPolytope newBoundPolytope)
Test for intersection with another bounds object
Parameters:
boundsObject - is another bounds object
newBoundPolytope - is the new bounding polytope which is the intersection of the boundsObject and this BoundingPolytope
Returns:
true or false indicating if an intersection occured

intersect

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

closestIntersection

public Bounds closestIntersection(Bounds[] boundsObjects)
Finds closest bounding object which intersects this bounding polytope
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