|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecty25.graphics.BoundingBox
Represents an axis-aligned bounding box in three dimensional space.
Note that an axis-aligned bounding box is fully specified by knowing the point with the smallest x,y,z-coordinates and the point with the biggest x,y,z-coordinates that still lies inside the bounding box.
A newly created bounding box does not bound anything and therefore it
isCollapsed()
. After one point has been added to the bounding
box, it is no longer collapsed, since now it bounds something - the point. It
has still no volume though and therefore it isEmpty()
. As
long as only points that lie on the same plane are added, the bounding box
still isEmpty()
. Only when the bounding box actually
encompasses a region of 3D-space that has a volume, it is no longer empty.
Field Summary | |
protected Point3D |
max
The point with the biggest x,y,z-coordinates that is still inside the bounding box. |
protected Point3D |
min
The point with the smallest x,y,z-coordinates that is still inside the bounding box. |
Constructor Summary | |
BoundingBox()
Creates a collapsed bounding box. |
|
BoundingBox(BoundingBox bb)
Creates a bounding box that is a copy of the passed bounding box. |
|
BoundingBox(Point3D pmin,
Point3D pmax)
Creates a bounding box by specifying the points in 3D space with the smallest and biggest x,y,z-coordinates that are still inside the bounding box. |
Method Summary | |
BoundingBox |
addBorder(float size)
Adds a border of the specified size around this bounding box. |
Point3D |
getCenter()
Returns the center of this bounding box. |
Point3D |
getMax()
Returns the point with the biggest x,y,z-coordinates that still lies inside the bounding box. |
Point3D |
getMin()
Returns the point with the smallest x,y,z-coordinates that still lies inside the bounding box. |
float |
getRadius()
Returns the radius of a bounding sphere that would encompass the entire bounding box if it was positioned at getCenter() . |
BoundingBox |
include(BoundingBox bb)
If necessary, enlarges this bounding box to also include the passed bounding box. |
BoundingBox |
include(Point3D p)
If necessary, enlarges this bounding box to include the passed point. |
BoundingBox |
includeX(float x)
If necessary, enlarges this bounding box to include at least one point that has the passed x-coordinate. |
BoundingBox |
includeY(float y)
If necessary, enlarges this bounding box to include at least one point that has the passed y-coordinate. |
BoundingBox |
includeZ(float z)
If necessary, enlarges this bounding box to include at least one point that has the passed z-coordinate. |
boolean |
isCollapsed()
Returns true if this bounding box is collapsed,
false otherwise. |
boolean |
isEmpty()
Returns true if this bounding box has no volume,
false otherwise. |
BoundingBox |
scale(float s)
Scales the entire bounding box by the given scaling factor. |
BoundingBox |
set(BoundingBox bb)
Sets this bounding box to the same extent as the passed bounding box. |
BoundingBox |
setCollapsed()
Returns this boudning box to a collapsed state. |
String |
toString()
|
BoundingBox |
translate(Vector3D v)
Moves the entire bounding box by the given vector. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Point3D min
protected Point3D max
Constructor Detail |
public BoundingBox()
public BoundingBox(BoundingBox bb)
public BoundingBox(Point3D pmin, Point3D pmax)
Method Detail |
public BoundingBox set(BoundingBox bb)
Returns a reference to this bounding box.
public BoundingBox include(BoundingBox bb)
If the passed bounding box is collapsed, calling this method has no effect.
Returns a reference to this bounding box.
public BoundingBox include(Point3D p)
Returns a reference to this bounding box.
public BoundingBox includeX(float x)
Returns a reference to this bounding box.
public BoundingBox includeY(float y)
Returns a reference to this bounding box.
public BoundingBox includeZ(float z)
Returns a reference to this bounding box.
public Point3D getCenter()
public Point3D getMin()
public Point3D getMax()
public float getRadius()
getCenter()
.
public boolean isCollapsed()
true
if this bounding box is collapsed,
false
otherwise.
public BoundingBox setCollapsed()
public boolean isEmpty()
true
if this bounding box has no volume,
false
otherwise.
Note that a collapsed bounding box also has no volume, so
true
is returned in this case as well.
public BoundingBox translate(Vector3D v)
Returns a reference to this bounding box.
public BoundingBox scale(float s)
Returns a reference to this bounding box.
public BoundingBox addBorder(float size)
Returns a reference to this bounding box.
public String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |