Constructor
new L3D.BoundingBox()
Properties
An empty BoundingBox.
The length of the box (z-axis extent)
The largest axis of the box.
The height of the box (y-axis extent)
The maximum extent of the bounding box.
The minimum extent of the bounding box.
The width of the box (x-axis extent)
Methods
static fromCenterHalfSize(center, halfSize) → BoundingBox
Create a bounding box with a center and half-size.
center |
Vector3 | |
halfSize |
Vector3 |
- BoundingBox
The new BoundingBox
static fromMinMax(min, max) → BoundingBox
Create a bounding box with the given extents.
min |
Vector3 | |
max |
Vector3 |
- BoundingBox
The new BoundingBox.
static fromPoint(point) → BoundingBox
Create a bounding box around the given point.
point |
Vector3 |
- BoundingBox
The new BoundingBox.
clear() → BoundingBox
Reset the box to (0,0,0)x(0,0,0).
- BoundingBox
Returns self.
clone() → BoundingBox
Create a copy of this BoundingBox.
- BoundingBox
The cloned BoundingBox.
contains(point) → bool
Determines if the box contains a given point.
point |
Vector3 |
- bool
True if the point is within the bounding box.
copy(other) → BoundingBox
Copy another BoundingBox.
other |
BoundingBox | The BoundingBox to copy. |
- BoundingBox
Returns self.
expand(amount) → BoundingBox
Expands (or shrinks) the box by a given amount.
amount |
Vector3 |
- BoundingBox
Returns this bounding box.
getCenter(_out)
Returns the centroid of the box
_out |
Vector3 |
getCorner(index, _out)
Returns the coordinates of a particular corner of the box.
index |
number | |
_out |
Vector3 |
getExtents(_out) → Vector3
Get the dimensions of the box.
_out |
Vector3 |
getSize(_out)
Get the dimensions of the box.
_out |
Vector3 |
include(b_x, y, z) → BoundingBox
Expands this box to include the given point or BoundingBox.
b_x |
* | |
y |
* | |
z |
* |
- BoundingBox
Returns this bounding box.
interpolate(uvw, _out) → Vector3
Given a value [uvw] in the range [0, 1], return the interpolated point within the box.
uvw |
Vecotr3 | |
_out |
Vector3 |
overlaps(other) → bool
Determines if this box overlaps the given box.
other |
BoundingBox | The BoundingBox to test. |
- bool
True if other overlaps.
rayIntersect(ray) → Array
Determine if the ray intersects this box.
ray |
Ray |
- Array
Returns [minDistance, maxDistance].
set(box) → BoundingBox
Set the values of the bounding box from another bounding box, a point, or a list of points.
box |
* |
- BoundingBox
Returns self.
setMinMax(arguments) → BoundingBox
Set the min and max extents of the bounding box.
arguments |
* | Either two vectors as min, max; or six floats as min, max. |
- BoundingBox
Returns self.
testSphere(center, radius) → bool
Test if a sphere intersects this bounding box.
center |
Vector3 | The center of the sphere |
radius |
number | The radius of the sphere. |
- bool
transform(transform) → BoundingBox
Transforms the box with a 4x4 transformation matrix
transform |
Matrix4 |
- BoundingBox
Returns this bounding box.
transformed(mat, out) → BoundingBox
Return a new BoundingBox that is this box transformed by [mat].
mat |
Matrix4 | |
out |
BoundingBox |
translate(t_x, y)
Translate the bounding box.
t_x |
* | |
y |
* |
volume() → number
Returns the volume encompassed by this box.
- number
The volume of the box.