Constructor
new Box3(min, max)
Parameters:
Name | Type | Description |
---|---|---|
min | t3d. | (optional) Vector3 representing the lower (x, y, z) boundary of the box. Default is ( + Infinity, + Infinity, + Infinity ). |
max | t3d. | (optional) Vector3 representing the upper (x, y, z) boundary of the box. Default is ( - Infinity, - Infinity, - Infinity ). |
Methods
applyMatrix4(matrix) → {t3d.Box3}
Transforms this Box3 with the supplied matrix.
Parameters:
Name | Type | Description |
---|---|---|
matrix | t3d. | The Matrix4 to apply |
Returns:
- Type:
- t3d.
Box3
clampPoint(point, target) → {t3d.Vector3}
Clamps the point within the bounds of this box.
Parameters:
Name | Type | Description |
---|---|---|
point | t3d. | Vector3 to clamp. |
target | t3d. | Vector3 to store the result in. |
Returns:
- Type:
- t3d.
Vector3
clone() → {t3d.Box3}
Returns a new Box3 with the same min and max as this one.
Returns:
- Type:
- t3d.
Box3
containsPoint(point) → {Boolean}
Returns true if the specified point lies within or on the boundaries of this box.
Parameters:
Name | Type | Description |
---|---|---|
point | t3d. | Vector3 to check for inclusion. |
Returns:
- Type:
- Boolean
copy(box) → {t3d.Box3}
Copies the min and max from box to this box.
Parameters:
Name | Type | Description |
---|---|---|
box | t3d. | Box3 to copy. |
Returns:
- Type:
- t3d.
Box3
distanceToPoint(point) → {Number}
Returns the distance from any edge of this box to the specified point. If the point lies inside of this box, the distance will be 0.
Parameters:
Name | Type | Description |
---|---|---|
point | t3d. | Vector3 to measure the distance to. |
Returns:
- Type:
- Number
equals(box) → {Boolean}
Returns true if this box and box share the same lower and upper bounds.
Parameters:
Name | Type | Description |
---|---|---|
box | t3d. | Box to compare with this one. |
Returns:
- Type:
- Boolean
expandByBox3(box3) → {t3d.Box3}
Expands the boundaries of this box to include box3.
Parameters:
Name | Type | Description |
---|---|---|
box3 | t3d. | Box that will be unioned with this box. |
Returns:
- Type:
- t3d.
Box3
expandByPoint(point) → {t3d.Box3}
Expands the boundaries of this box to include point.
Parameters:
Name | Type | Description |
---|---|---|
point | t3d. | Vector3 that should be included in the box. |
Returns:
- Type:
- t3d.
Box3
expandByScalar(scalar) → {t3d.Box3}
Expands each dimension of the box by scalar. If negative, the dimensions of the box will be contracted.
Parameters:
Name | Type | Description |
---|---|---|
scalar | Number | Distance to expand the box by. |
Returns:
- Type:
- t3d.
Box3
getBoundingSphere(target) → {t3d.Sphere}
Returns aMinimum Bounding Sphere for the box.
Parameters:
Name | Type | Description |
---|---|---|
target | t3d. | — the result will be copied into this Sphere. |
Returns:
- Type:
- t3d.
Sphere
getCenter(target) → {t3d.Vector3}
Returns the center point of the box as a Vector3.
Parameters:
Name | Type | Description |
---|---|---|
target | t3d. | the result will be copied into this Vector3. |
Returns:
- Type:
- t3d.
Vector3
getSize(target) → {t3d.Vector3}
Returns the width, height and depth of this box.
Parameters:
Name | Type | Description |
---|---|---|
target | t3d. | the result will be copied into this Vector3. |
Returns:
- Type:
- t3d.
Vector3
intersectsTriangle(triangle) → {Boolean}
Determines whether or not this box intersects triangle.
Parameters:
Name | Type | Description |
---|---|---|
triangle | t3d. | Triangle to check for intersection against. |
Returns:
- Type:
- Boolean
isEmpty() → {Boolean}
Returns true if this box includes zero points within its bounds.
Returns:
- Type:
- Boolean
makeEmpty() → {t3d.Box3}
Makes this box empty.
Returns:
- Type:
- t3d.
Box3
set(min, max)
Sets the lower and upper (x, y, z) boundaries of this box.
Parameters:
Name | Type | Description |
---|---|---|
min | t3d. | Vector3 representing the lower (x, y, z) boundary of the box. |
max | t3d. | Vector3 representing the lower upper (x, y, z) boundary of the box. |
setFromArray(array, gapopt, offsetopt) → {t3d.Box3}
Sets the upper and lower bounds of this box to include all of the data in array.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
array | Array.<Number> | An array of position data that the resulting box will envelop. | ||
gap | Number | <optional> | 3 | |
offset | Number | <optional> | 0 |
Returns:
- Type:
- t3d.
Box3
setFromPoints(points) → {t3d.Box3}
Sets the upper and lower bounds of this box to include all of the points in points.
Parameters:
Name | Type | Description |
---|---|---|
points | Array.<t3d.Vector3> | Array of Vector3s that the resulting box will contain. |
Returns:
- Type:
- t3d.
Box3
union(box) → {t3d.Box3}
Computes the union of this box and box, setting the upper bound of this box to the greater of the two boxes' upper bounds and the lower bound of this box to the lesser of the two boxes' lower bounds.
Parameters:
Name | Type | Description |
---|---|---|
box | t3d. | Box that will be unioned with this box. |
Returns:
- Type:
- t3d.
Box3