public class BoundingBox
extends java.lang.Object
implements java.io.Serializable
| Constructor and Description |
|---|
BoundingBox()
Constructs a new bounding box with the minimum and maximum vector set to zeros.
|
BoundingBox(BoundingBox bounds)
Constructs a new bounding box from the given bounding box.
|
BoundingBox(Vector3 minimum,
Vector3 maximum)
Constructs the new bounding box using the given minimum and maximum vector.
|
| Modifier and Type | Method and Description |
|---|---|
BoundingBox |
clr()
Sets the minimum and maximum vector to zeros.
|
boolean |
contains(BoundingBox b)
Returns whether the given bounding box is contained in this bounding box.
|
boolean |
contains(Vector3 v)
Returns whether the given vector is contained in this bounding box.
|
BoundingBox |
ext(BoundingBox a_bounds)
Extends this bounding box by the given bounding box.
|
BoundingBox |
ext(BoundingBox bounds,
Matrix4 transform)
Extends this bounding box by the given transformed bounding box.
|
BoundingBox |
ext(float x,
float y,
float z)
Extends the bounding box by the given vector.
|
BoundingBox |
ext(Vector3 point)
Extends the bounding box to incorporate the given
Vector3. |
BoundingBox |
ext(Vector3 center,
float radius)
Extends this bounding box by the given sphere.
|
Vector3 |
getCenter(Vector3 out) |
float |
getCenterX() |
float |
getCenterY() |
float |
getCenterZ() |
Vector3 |
getCorner000(Vector3 out) |
Vector3 |
getCorner001(Vector3 out) |
Vector3 |
getCorner010(Vector3 out) |
Vector3 |
getCorner011(Vector3 out) |
Vector3 |
getCorner100(Vector3 out) |
Vector3 |
getCorner101(Vector3 out) |
Vector3 |
getCorner110(Vector3 out) |
Vector3 |
getCorner111(Vector3 out) |
float |
getDepth() |
Vector3 |
getDimensions(Vector3 out) |
float |
getHeight() |
Vector3 |
getMax(Vector3 out) |
Vector3 |
getMin(Vector3 out) |
float |
getWidth() |
BoundingBox |
inf()
Sets the minimum and maximum vector to positive and negative infinity.
|
boolean |
intersects(BoundingBox b)
Returns whether the given bounding box is intersecting this bounding box (at least one point in).
|
boolean |
isValid()
Returns whether this bounding box is valid.
|
BoundingBox |
mul(Matrix4 transform)
Multiplies the bounding box by the given matrix.
|
BoundingBox |
set(BoundingBox bounds)
Sets the given bounding box.
|
BoundingBox |
set(java.util.List<Vector3> points)
Sets the bounding box minimum and maximum vector from the given points.
|
BoundingBox |
set(Vector3[] points)
Sets the bounding box minimum and maximum vector from the given points.
|
BoundingBox |
set(Vector3 minimum,
Vector3 maximum)
Sets the given minimum and maximum vector.
|
java.lang.String |
toString() |
public BoundingBox()
public BoundingBox(BoundingBox bounds)
bounds - The bounding box to copypublic Vector3 getCenter(Vector3 out)
out - The Vector3 to receive the center of the bounding box.public float getCenterX()
public float getCenterY()
public float getCenterZ()
public Vector3 getDimensions(Vector3 out)
out - The Vector3 to receive the dimensions of this bounding box on all three axis.public float getWidth()
public float getHeight()
public float getDepth()
public Vector3 getMin(Vector3 out)
out - The Vector3 to receive the minimum values.public Vector3 getMax(Vector3 out)
out - The Vector3 to receive the maximum values.public BoundingBox set(BoundingBox bounds)
bounds - The bounds.public BoundingBox set(Vector3 minimum, Vector3 maximum)
minimum - The minimum vectormaximum - The maximum vectorpublic BoundingBox set(Vector3[] points)
points - The points.public BoundingBox set(java.util.List<Vector3> points)
points - The points.public BoundingBox inf()
public BoundingBox ext(Vector3 point)
Vector3.point - The vectorpublic BoundingBox clr()
public boolean isValid()
public BoundingBox ext(BoundingBox a_bounds)
a_bounds - The bounding boxpublic BoundingBox ext(Vector3 center, float radius)
center - Sphere centerradius - Sphere radiuspublic BoundingBox ext(BoundingBox bounds, Matrix4 transform)
bounds - The bounding boxtransform - The transformation matrix to apply to bounds, before using it to extend this bounding box.public BoundingBox mul(Matrix4 transform)
transform - The matrixpublic boolean contains(BoundingBox b)
b - The bounding boxpublic boolean intersects(BoundingBox b)
b - The bounding boxpublic boolean contains(Vector3 v)
v - The vectorpublic java.lang.String toString()
toString in class java.lang.Objectpublic BoundingBox ext(float x, float y, float z)
x - The x-coordinatey - The y-coordinatez - The z-coordinate