Creates a new Box
Left out, the box starts empty, so the first Box#expandByPoint gives a tight fit. Vectors passed in become the box's corners; they are not copied.
ReadonlymaxThe corner with the largest x, y and z; -Infinity on every axis in a new, empty box
ReadonlyminThe corner with the smallest x, y and z; +Infinity on every axis in a new, empty box
ReadonlytypeNames the shape without an instanceof check, like the type on pixi's 2D shapes
The width (X extent) of this box; -Infinity for a new, empty box, where
Box#getSize gives 0
Transforms this box by an affine matrix, then fits a new axis-aligned box around the result
The new box holds all eight transformed corners, so rotating a box can grow it. An empty box stays empty.
matrix must be affine (bottom row [0, 0, 0, 1]), as a Container3D#worldTransform
always is and a projection matrix isn't.
The result box for chaining
Writes the closest point on this box to point into out (or a new Vector3)
A point inside the box comes back unchanged.
The point to clamp
Optionalout: Vector3
Optional vector to write into; a new Vector3 when omitted
The closest point on this box
Returns true when box is fully inside this box (boundary is inclusive)
A new, empty box counts as inside any box.
The box to test
Whether the box is fully inside this box
Returns true when point is inside this box (boundary is inclusive)
The point to test
Whether the point is inside this box
Returns the Euclidean distance from point to the closest point on this box (0 if inside)
The point to measure from
The distance to the closest point on this box
Returns true when both corners match box exactly (no epsilon tolerance)
The box to compare with
Whether both corners match
Grows this box to enclose point
The point to enclose
Target to write the result into instead of mutating this box
The result box for chaining
Returns true when this box and box overlap; boxes that only touch count
The box to test
Whether the boxes overlap
Returns true when plane passes through this box or touches it
The plane to test
Whether the plane passes through or touches the box
Returns true when ray hits this box; same as Ray#intersectsBox
The ray to test
Whether the ray hits this box
Returns true when this box and sphere overlap; an empty sphere never does
The sphere to test
Whether the box and sphere overlap
Sets the corners of this box to min and max, copying their values
The minimum corner
The maximum corner
This box for chaining
Advanced
Returns a string representation of this box
A string in the form [@pixi/3d/math:Box min=(0, 0, 0) max=(1, 1, 1)]
StaticfromCreates a box centred at center with the given full size
A number makes a cube; a point sets the size of each axis.
The center of the box
The full size of the box, uniform or per-axis
The new box
An axis-aligned bounding box (AABB), spanning from its
mincorner to itsmaxcornerUse one to bound a mesh or a group and to run cheap overlap, culling and picking tests before precise ones. Container3D#getLocalBounds measures one for a subtree.
Example
See
Ray#intersectBox For the point where a ray hits the box