public class Box extends Object implements IBox, Serializable
Modifier and Type | Field and Description |
---|---|
static Box |
EMPTY
The empty box.
|
static Box |
MAX_VALUE
A box that's as large as boxes can get.
|
static Box |
UNIT
The unit box.
|
static Box |
ZERO
The zero box.
|
Constructor and Description |
---|
Box()
Creates an empty box.
|
Box(IBox other)
Copy constructor.
|
Box(IVector3 minExtent,
IVector3 maxExtent)
Creates a box with the values contained in the supplied minimum and maximum extents.
|
Modifier and Type | Method and Description |
---|---|
Box |
add(IBox other)
Expands this box to include the bounds of another box.
|
Box |
add(IBox other,
Box result)
Expands this box to include the bounds of another box, placing the result in the object
provided.
|
Box |
add(IVector3 point)
Expands this box to include the specified point.
|
Box |
add(IVector3 point,
Box result)
Expands this box to include the specified point, placing the result in the object
provided.
|
Box |
addLocal(IBox other)
Expands this box to include the bounds of another box.
|
Box |
addLocal(IVector3 point)
Expands this box in-place to include the specified point.
|
Vector3 |
center()
Returns the center of the box as a new vector.
|
Vector3 |
center(Vector3 result)
Places the location of the center of the box into the given result vector.
|
boolean |
contains(float x,
float y,
float z)
Determines whether this box contains the specified point.
|
boolean |
contains(IBox other)
Determines whether this box completely contains the specified box.
|
boolean |
contains(IVector3 point)
Determines whether this box contains the specified point.
|
float |
diagonalLength()
Returns the length of the box's diagonal (the distance from minimum to maximum extent).
|
boolean |
equals(Object other) |
Box |
expand(float x,
float y,
float z)
Expands the box by the specified amounts.
|
Box |
expand(float x,
float y,
float z,
Box result)
Expands the box by the specified amounts, placing the result in the object provided.
|
Box |
expandLocal(float x,
float y,
float z)
Expands the box in-place by the specified amounts.
|
float |
extentDistance(IBox other)
Returns the sum of the Manhattan distances between the extents of this box and the
specified other box.
|
Box |
fromPoints(IVector3... points)
Initializes this box with the extents of an array of points.
|
int |
hashCode() |
Box |
intersect(IBox other)
Finds the intersection between this box and another box.
|
Box |
intersect(IBox other,
Box result)
Finds the intersection between this box and another box and places the result in the
provided object.
|
boolean |
intersection(IRay3 ray,
Vector3 result)
Finds the location of the (first) intersection between the specified ray and this box.
|
Box |
intersectLocal(IBox other)
Finds the intersection between this box and another box and places the result in this box.
|
boolean |
intersects(IBox other)
Determines whether this box intersects the specified other box.
|
boolean |
intersects(IRay3 ray)
Determines whether the specified ray intersects this box.
|
boolean |
isEmpty()
Determines whether the box is empty (whether any of its minima are greater than their
corresponding maxima).
|
float |
longestEdge()
Returns the length of the box's longest edge.
|
IVector3 |
maximumExtent()
Returns a reference to the box's maximum extent.
|
IVector3 |
minimumExtent()
Returns a reference to the box's minimum extent.
|
Box |
project(IMatrix4 matrix)
Projects this box.
|
Box |
project(IMatrix4 matrix,
Box result)
Projects this box, placing the result in the object provided.
|
Box |
projectLocal(IMatrix4 matrix)
Projects this box in-place.
|
Box |
set(IBox other)
Copies the parameters of another box.
|
Box |
set(IVector3 minExtent,
IVector3 maxExtent)
Sets the box parameters to the values contained in the supplied vectors.
|
Box |
setToEmpty()
Sets the parameters of the box to the empty values (
Vector3.MAX_VALUE and
Vector3.MIN_VALUE for the minimum and maximum, respectively). |
String |
toString() |
Vector3 |
vertex(int code,
Vector3 result)
Retrieves one of the eight vertices of the box.
|
public static final Box UNIT
public static final Box ZERO
public static final Box EMPTY
public static final Box MAX_VALUE
public Box(IVector3 minExtent, IVector3 maxExtent)
public Box(IBox other)
public Box()
public Box setToEmpty()
Vector3.MAX_VALUE
and
Vector3.MIN_VALUE
for the minimum and maximum, respectively).public Box set(IBox other)
public Box set(IVector3 minExtent, IVector3 maxExtent)
public Box fromPoints(IVector3... points)
public Box addLocal(IVector3 point)
public Box addLocal(IBox other)
public Box intersectLocal(IBox other)
public Box projectLocal(IMatrix4 matrix)
public Box expandLocal(float x, float y, float z)
public IVector3 minimumExtent()
IBox
minimumExtent
in interface IBox
public IVector3 maximumExtent()
IBox
maximumExtent
in interface IBox
public Vector3 center()
IBox
public Vector3 center(Vector3 result)
IBox
public float diagonalLength()
IBox
diagonalLength
in interface IBox
public float longestEdge()
IBox
longestEdge
in interface IBox
public boolean isEmpty()
IBox
public Box add(IVector3 point)
IBox
public Box add(IVector3 point, Box result)
IBox
public Box add(IBox other)
IBox
public Box add(IBox other, Box result)
IBox
public Box intersect(IBox other)
IBox
public Box intersect(IBox other, Box result)
IBox
public Box project(IMatrix4 matrix)
IBox
public Box project(IMatrix4 matrix, Box result)
IBox
public Box expand(float x, float y, float z)
IBox
public Box expand(float x, float y, float z, Box result)
IBox
public Vector3 vertex(int code, Vector3 result)
IBox
public boolean contains(IVector3 point)
IBox
public boolean contains(float x, float y, float z)
IBox
public float extentDistance(IBox other)
IBox
extentDistance
in interface IBox
public boolean contains(IBox other)
IBox
public boolean intersects(IBox other)
IBox
intersects
in interface IBox
public boolean intersects(IRay3 ray)
IBox
intersects
in interface IBox
public boolean intersection(IRay3 ray, Vector3 result)
IBox
intersection
in interface IBox
result
- a vector to hold the location of the intersection.Copyright © 2017. All rights reserved.