|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.gaffga.parrotengine.boundings.AABoundingBox
public class AABoundingBox
This is an axis aligned bounding box.
| Nested Class Summary | |
|---|---|
static class |
AABoundingBox.AABoundingBoxSides
The different planes that are bordering the box. |
| Constructor Summary | |
|---|---|
AABoundingBox()
Default constructor. |
|
AABoundingBox(AABoundingBox box)
Copy constructor. |
|
AABoundingBox(Vector center,
double width,
double height,
double depth)
Constructs a new axis aligned bounding box from a center point and the extensions in three dimensions. |
|
AABoundingBox(Vector p0,
Vector p1)
Constructs a new axis aligned bounding box from two opposite points. |
|
| Method Summary | |
|---|---|
boolean |
contains(Vector v)
Checks whether a given point is contained within this bounding box. |
Vector |
getCenter()
Returns the center of the box. |
double |
getDepth()
Returns the depth of the box. |
double |
getDistance(Vector p)
Calculates the distance of a point to the box. |
double |
getHeight()
Returns the height of the box. |
Vector |
getHitpoint(Ray ray2)
Checks whether the box hits the given ray and returns the nearest hitpoint. |
Vector |
getP0()
Returns the first corner point. |
Vector |
getP1()
Returns the second (opposite of first) corner point. |
Plane |
getPlane(AABoundingBox.AABoundingBoxSides plane)
Returns a specifiy plane of the box. |
Plane[] |
getPlanes()
Returns the array of the planes that are bordering this box. |
AABoundingBox |
getQuadBox(int idx)
Returns a given smaller bounding box for QuadTree use. |
Rectangle3D |
getSide(AABoundingBox.AABoundingBoxSides side)
Returns a specific side of the box as a Rectangle3D. |
Vector[] |
getVertices()
Returns the vertex list of this bounding box - the 8 points that form the box. |
double |
getWidth()
Returns the width of the box. |
void |
initFromOppositePoints(Vector p0,
Vector p1)
(Re)initializes this AABoundingBox using two opposite points. |
static AABoundingBox |
mul(AABoundingBox box,
Matrix mat)
Creates a new AABoundingBox that completely contains the given bounding box that is transformed using the given matrix. |
java.lang.String |
toString()
Returns a string representation of this object. |
void |
union(AABoundingBox box)
Unify the current bounding box with the given. |
static AABoundingBox |
union(AABoundingBox box1,
AABoundingBox box2)
Constructs a new AABoundingBox that contains the two given. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public AABoundingBox()
public AABoundingBox(Vector center,
double width,
double height,
double depth)
center - the center of the boxwidth - the width of the boxheight - the height of the boxdepth - the depth of the boxpublic AABoundingBox(AABoundingBox box)
box - the box to copy
public AABoundingBox(Vector p0,
Vector p1)
p0 - the first pointp1 - the second point| Method Detail |
|---|
public void initFromOppositePoints(Vector p0,
Vector p1)
p0 - the first pointp1 - the second pointpublic AABoundingBox getQuadBox(int idx)
idx - the index of the smaller cube - can be 0 to 3.
public boolean contains(Vector v)
v - the point to test
public java.lang.String toString()
toString in class java.lang.Objectpublic Vector[] getVertices()
public static AABoundingBox mul(AABoundingBox box,
Matrix mat)
box - the box to transformmat - the matrix to use for transformation
public static AABoundingBox union(AABoundingBox box1,
AABoundingBox box2)
box1 - the first bounding boxbox2 - the second bounding box
public void union(AABoundingBox box)
box - the bounding box to addpublic Vector getP0()
public Vector getP1()
public Plane getPlane(AABoundingBox.AABoundingBoxSides plane)
plane - the desired plane
public Rectangle3D getSide(AABoundingBox.AABoundingBoxSides side)
Rectangle3D.
side - the side to return
public Plane[] getPlanes()
public Vector getCenter()
public Vector getHitpoint(Ray ray2)
ray2 - the ray to test the box against
public double getDistance(Vector p)
p - the point
public double getWidth()
public double getHeight()
public double getDepth()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||