BoundingBox
Methods
addBounds
Adds another bounding box to this one.
| Argument | Type | Required | Description |
|---|---|---|---|
xMin | number | Yes | |
xMax | number | Yes | |
yMin | number | Yes | |
yMax | number | Yes | |
zMin | number | Yes | |
zMax | number | Yes |
addBounds
Adds two bounding boxes together.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
xMin | number | Yes | |
xMax | number | Yes | |
yMin | number | Yes | |
yMax | number | Yes | |
zMin | number | Yes | |
zMax | number | Yes |
addPoint
Adds a point to this bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
xOrPoint | number or Array[Number] or TypedArray | Yes | |
y | number | Yes | |
z | number | Yes |
addPoint
Adds points to a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
x | number | Yes | |
y | number | Yes | |
z | number | Yes |
addPoints
Adds points to this bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
points | Array[number] | Yes | A flattened array of 3D coordinates. |
addPoints
Adds points to a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
points | Array[number] | Yes | A flattened array of 3D coordinates. |
clampDivisions
Clamp the divisions to ensure the total number doesn't exceed targetBins
| Argument | Type | Required | Description |
|---|---|---|---|
targetBins | Number | Yes | - Maximum number of bins allowed |
divs | Array[Number] | Yes | - Divisions array to adjust [divX, divY, divZ] |
computeCornerPoints
Computes the two corner points with min and max coords.
| Argument | Type | Required | Description |
|---|---|---|---|
point1 | Vector3 | Yes | |
point2 | Vector3 | Yes |
computeCornerPoints
Computes the two corner points with min and max coords.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
point1 | Vector3 | Yes | |
point2 | Vector3 | Yes |
computeDivisions
Compute the number of divisions given this bounding box and a target number of buckets/bins. Handles degenerate bounding boxes properly.
| Argument | Type | Required | Description |
|---|---|---|---|
totalBins | Number | Yes | - Target number of bins |
divs | Array[Number] | Yes | - Output array to store divisions [divX, divY, divZ] |
adjustedBounds | Bounds | No | - Output array to store adjusted bounds if needed |
Returns
| Type | Description |
|---|---|
| Number | The actual total number of bins |
computeDivisions
Compute the number of divisions given the current bounding box and a target number of buckets/bins. Handles degenerate bounding boxes properly.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | - The bounding box |
totalBins | Number | Yes | - Target number of bins |
divs | Array[Number] | Yes | - Output array to store divisions [divX, divY, divZ] |
adjustedBounds | Bounds | No | - Output array to store adjusted bounds if needed |
Returns
| Type | Description |
|---|---|
| Number | The actual total number of bins |
computeLocalBounds
Compute local bounds along the given basis.
| Argument | Type | Required | Description |
|---|---|---|---|
u | array | Yes | first vector |
v | array | Yes | second vector |
w | array | Yes | third vector |
computeLocalBounds
Compute local bounds. Not as fast as vtkPoints.getBounds() if u, v, w form a natural basis.
| Argument | Type | Required | Description |
|---|---|---|---|
points | vtkPoints | Yes | |
u | array | Yes | first vector |
v | array | Yes | second vector |
w | array | Yes | third vector |
computeScale3
Computes the half lengths of this bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
scale3 | Vector3 | No |
contains
Is another bounding box contained in this one.
| Argument | Type | Required | Description |
|---|---|---|---|
otherBounds | Bounds | Yes |
contains
Is a bbox contained in another bbox.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
other | Bounds | Yes |
containsPoint
Does this bounding box contain a given point.
| Argument | Type | Required | Description |
|---|---|---|---|
x | number | Yes | |
y | number | Yes | |
z | number | Yes |
containsPoint
Does the bbox contain a given point.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
x | number | Yes | |
y | number | Yes | |
z | number | Yes |
cutWithPlane
Does a plane cut this bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
origin | Vector3 | Yes | |
normal | Vector3 | Yes |
cutWithPlane
Does a plane intersect a boox.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
origin | Vector3 | Yes | |
normal | Vector3 | Yes |
distance2ToBounds
Calculate the squared distance from point x to this bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
x | Vector3 | Yes | The point coordinates |
Returns
| Type | Description |
|---|---|
| Number | The squared distance to the bounds |
distance2ToBounds
Calculate the squared distance from point x to the specified bounds.
| Argument | Type | Required | Description |
|---|---|---|---|
x | Vector3 | Yes | The point coordinates |
bounds | Bounds | Yes | The bounding box coordinates |
Returns
| Type | Description |
|---|---|
| Number | The squared distance to the bounds |
equals
Tests whether the given bounds equal this one.
| Argument | Type | Required | Description |
|---|---|---|---|
otherBounds | Bounds | Yes |
equals
Tests whether two bounds equal.
| Argument | Type | Required | Description |
|---|---|---|---|
a | Bounds | Yes | |
b | Bounds | Yes |
getCenter
Gets the center of this bounding box.
getCenter
Gets the center of a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getCorners
Gets the corners of this bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
corners | Array[Vector3] | Yes |
getCorners
Gets the corners of a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
corners | Array[Vector3] | Yes |
getDiagonalLength
Gets the diagonal length of this bounding box.
getDiagonalLength
Gets the diagonal length of the bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getDiagonalLength2
Gets the squared diagonal length of this bounding box.
getDiagonalLength2
Gets the squared diagonal length of the bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getLength
Gets a side length of this bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
index | number | Yes |
getLength
Gets the bounding box side length.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
index | number | Yes |
getLengths
Gets the lengths of all sides.
getLengths
Gets the lengths of all sides.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getMaxLength
Gets the maximum side length of this bounding box.
getMaxLength
Gets the maximum side length of the bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getMaxPoint
Gets the max point.
getMaxPoint
Gets the max point.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getMinPoint
Gets the min point.
getMinPoint
Gets the min point.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getXRange
Gets the x range of this bounding box.
getXRange
Gets the x range of a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getYRange
Gets the y range of this bounding box.
getYRange
Gets the y range of a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getZRange
Gets the z range of this bounding box.
getZRange
Gets the z range of a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
inflate
Inflates this bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
delta | number | No | The amount to inflate the bounding box by. |
intersect
Intersect this bounding box with another one, storing the result in this one.
| Argument | Type | Required | Description |
|---|---|---|---|
otherBounds | Bounds | Yes |
intersect
Do two bounding boxes intersect.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
bBounds | Yes |
intersectBox
The method returns a non-zero value if the bounding box is hit. Origin[3] starts the ray, dir[3] is the vector components of the ray in the x-y-z directions, coord[3] is the location of hit, and t is the parametric coordinate along line. (Notes: the intersection ray dir[3] is NOT normalized. Valid intersections will only occur between 0<=t<=1.)
| Argument | Type | Required | Description |
|---|---|---|---|
origin | Vector3 | Yes | |
dir | Vector3 | Yes | |
coord | Vector3 | Yes | |
tolerance | Array[number] | Yes |
intersectBox
The method returns a non-zero value if the bounding box is hit. Origin[3] starts the ray, dir[3] is the vector components of the ray in the x-y-z directions, coord[3] is the location of hit, and t is the parametric coordinate along line. (Notes: the intersection ray dir[3] is NOT normalized. Valid intersections will only occur between 0<=t<=1.)
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
origin | Vector3 | Yes | |
dir | Vector3 | Yes | |
coord | Vector3 | Yes | |
tolerance | number | Yes |
intersectPlane
Plane intersection with box The plane is infinite in extent and defined by an origin and normal.The function indicates whether the plane intersects, not the particulars of intersection points and such The function returns non-zero if the plane and box intersect; zero otherwise.
| Argument | Type | Required | Description |
|---|---|---|---|
origin | Vector3 | Yes | |
normal | Vector3 | Yes |
intersectPlane
Plane intersection with box The plane is infinite in extent and defined by an origin and normal.The function indicates whether the plane intersects, not the particulars of intersection points and such The function returns non-zero if the plane and box intersect; zero otherwise.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
origin | Vector3 | Yes | |
normal | Vector3 | Yes |
intersects
Does another bounding box intersect this one.
| Argument | Type | Required | Description |
|---|---|---|---|
otherBounds | Bounds | Yes |
intersects
Do two bounding boxes intersect.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
bBounds | Bounds | Yes |
isValid
Tests whether this bounding box is valid.
isValid
Tests whether a given bounds is valid.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
reset
Resets this bounds to infinity.
reset
Resets a bounds to infinity.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
scale
Scales this bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
sx | number | Yes | |
sy | number | Yes | |
sz | number | Yes |
scale
Scales a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
sx | number | Yes | |
sy | number | Yes | |
sz | number | Yes |
scaleAboutCenter
Scales a bounding box around its center.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
sx | number | Yes | |
sy | number | Yes | |
sz | number | Yes |
setBounds
Sets this bounding box from another bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
otherBounds | Bounds | Yes |
setBounds
Sets a bounding box from another bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
other | Bounds | Yes |
setMaxPoint
Sets the max point of this bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
x | number | Yes | |
y | number | Yes | |
z | number | Yes |
setMaxPoint
Sets the max point of a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
x | number | Yes | |
y | number | Yes | |
z | number | Yes |
setMinPoint
Sets the min point of this bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
x | number | Yes | |
y | number | Yes | |
z | number | Yes |
setMinPoint
Sets the min point of a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
x | number | Yes | |
y | number | Yes | |
z | number | Yes |
transformBounds
Transforms this bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
transform | mat4 | Yes | |
out | Bounds | No |
transformBounds
Transforms a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
transform | mat4 | Yes | |
out | Bounds | Yes |