Box3
A 3D box.
Constructor Summary
Public Constructor | ||
public |
constructor(min: Vector3, max: Vector3) Constructs a new box. |
Member Summary
Public Members | ||
public |
The upper bounds. |
|
public |
The lower bounds. |
Method Summary
Public Methods | ||
public |
applyMatrix4(m: Matrix4): Box3 Applies the given matrix to this box. |
|
public |
clampPoint(point: Vector3, target: Vector3): Vector3 Clamps the given point to the boundaries of this box. |
|
public |
Clones this box. |
|
public |
containsBox(b: Box3): Boolean Checks if the given box lies inside this box. |
|
public |
containsPoint(p: Vector3): Boolean Checks if the given point lies inside this box. |
|
public |
Copies the values of a given box. |
|
public |
distanceToPoint(p: Vector3): Number Calculates the distance from this box to the given point. |
|
public |
Checks if this box equals the given one. |
|
public |
expandByPoint(p: Vector3): Box3 Expands this box by the given point. |
|
public |
expandByScalar(s: Number): Box3 Expands this box by the given scalar. |
|
public |
expandByVector(v: Vector3): Box3 Expands this box by the given vector. |
|
public |
Computes the center of this box. |
|
public |
Computes the size of this box. |
|
public |
Intersects this box with the given one. |
|
public |
intersectsBox(b: Box3): Boolean Checks if this box intersects the given one. |
|
public |
intersectsPlane(p: Plane): Boolean Checks if this box intersects the given plane. |
|
public |
Checks if this box intersects the given sphere. |
|
public |
Indicates whether this box is truly empty. |
|
public |
Makes this box empty. |
|
public |
Sets the values of this box. |
|
public |
setFromCenterAndSize(center: Vector3, size: Number): Box3 Defines this box by the given center and size. |
|
public |
setFromPoints(points: Vector3[]): Box3 Defines this box by the given points. |
|
public |
setFromSphere(sphere: Sphere): Box3 Computes the bounding box of the given sphere. |
|
public |
Translates this box. |
|
public |
Expands this box by combining it with the given one. |
Public Constructors
Public Members
Public Methods
public applyMatrix4(m: Matrix4): Box3 source
Applies the given matrix to this box.
Params:
Name | Type | Attribute | Description |
m | Matrix4 | The matrix. |
public clampPoint(point: Vector3, target: Vector3): Vector3 source
Clamps the given point to the boundaries of this box.
public containsBox(b: Box3): Boolean source
Checks if the given box lies inside this box.
Params:
Name | Type | Attribute | Description |
b | Box3 | A box. |
public containsPoint(p: Vector3): Boolean source
Checks if the given point lies inside this box.
Params:
Name | Type | Attribute | Description |
p | Vector3 | A point. |
public copy(b: Box3): Box3 source
Copies the values of a given box.
Params:
Name | Type | Attribute | Description |
b | Box3 | A box. |
public distanceToPoint(p: Vector3): Number source
Calculates the distance from this box to the given point.
Params:
Name | Type | Attribute | Description |
p | Vector3 | A point. |
public equals(b: Box3): Boolean source
Checks if this box equals the given one.
Params:
Name | Type | Attribute | Description |
b | Box3 | A box. |
public expandByPoint(p: Vector3): Box3 source
Expands this box by the given point.
Params:
Name | Type | Attribute | Description |
p | Vector3 | A point. |
public expandByScalar(s: Number): Box3 source
Expands this box by the given scalar.
Params:
Name | Type | Attribute | Description |
s | Number | A scalar. |
public expandByVector(v: Vector3): Box3 source
Expands this box by the given vector.
Params:
Name | Type | Attribute | Description |
v | Vector3 | A vector. |
public getCenter(target: Vector3): Vector3 source
Computes the center of this box.
Params:
Name | Type | Attribute | Description |
target | Vector3 |
|
A target vector. If none is provided, a new one will be created. |
public getSize(target: Vector3): Vector3 source
Computes the size of this box.
Params:
Name | Type | Attribute | Description |
target | Vector3 |
|
A target vector. If none is provided, a new one will be created. |
public intersect(b: Box3): Box3 source
Intersects this box with the given one.
Params:
Name | Type | Attribute | Description |
b | Box3 | A box. |
public intersectsBox(b: Box3): Boolean source
Checks if this box intersects the given one.
Params:
Name | Type | Attribute | Description |
b | Box3 | A box. |
public intersectsPlane(p: Plane): Boolean source
Checks if this box intersects the given plane.
Computes the minimum and maximum dot product values. If those values are on the same side (back or front) of the plane, then there is no intersection.
Params:
Name | Type | Attribute | Description |
p | Plane | A plane. |
public intersectsSphere(s: Sphere): Boolean source
Checks if this box intersects the given sphere.
Params:
Name | Type | Attribute | Description |
s | Sphere | A sphere. |
public isEmpty(): Box3 source
Indicates whether this box is truly empty.
This is a more robust check for emptiness since the volume can get positive with two negative axes.
public makeEmpty(): Box3 source
Makes this box empty.
The lower bounds are set to infinity and the upper bounds to negative infinity to create an infinitely small box.
public setFromCenterAndSize(center: Vector3, size: Number): Box3 source
Defines this box by the given center and size.
public setFromPoints(points: Vector3[]): Box3 source
Defines this box by the given points.
Params:
Name | Type | Attribute | Description |
points | Vector3[] | The points. |
public setFromSphere(sphere: Sphere): Box3 source
Computes the bounding box of the given sphere.
Params:
Name | Type | Attribute | Description |
sphere | Sphere | A sphere. |