BoundingBox
Methods
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 |
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 points to a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
x | number | 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 a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
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 |
|---|---|---|---|
bounds | Bounds | Yes | |
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 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. 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 |
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 |
contains
Is a bbox contained in another bbox.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
other | Bounds | Yes |
contains
Is a bbox contained in another bbox.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
other | Bounds | 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 |
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 intersect a boox.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
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 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 |
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 two bounds equal.
| Argument | Type | Required | Description |
|---|---|---|---|
a | Bounds | Yes | |
b | Bounds | Yes |
equals
Tests whether two bounds equal.
| Argument | Type | Required | Description |
|---|---|---|---|
a | Bounds | Yes | |
b | Bounds | Yes |
getCenter
Gets the center of a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getCenter
Gets the center of a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getCorners
Gets the corners of a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
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 the bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getDiagonalLength
Gets the diagonal length of the bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getDiagonalLength2
Gets the squared diagonal length of the bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getDiagonalLength2
Gets the squared diagonal length of the bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getLength
Gets the bounding box side length.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
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.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getLengths
Gets the lengths of all sides.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getMaxLength
Gets the maximum side length of the bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getMaxLength
Gets the maximum side length of the bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getMaxPoint
Gets the max point.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getMaxPoint
Gets the max point.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getMinPoint
Gets the min point.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getMinPoint
Gets the min point.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getXRange
Gets the x range of a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getXRange
Gets the x range of a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getYRange
Gets the y range of a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getYRange
Gets the y range of a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getZRange
Gets the z range of a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
getZRange
Gets the z range of a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
inflate
Inflates a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
delta | number | No | The amount to inflate the bounding box by. |
inflate
Inflates a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
delta | number | Yes |
intersect
Do two bounding boxes intersect.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
bBounds | 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 |
|---|---|---|---|
bounds | Bounds | Yes | |
origin | Vector3 | Yes | |
dir | Vector3 | Yes | |
coord | Vector3 | Yes | |
tolerance | 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 |
|---|---|---|---|
bounds | Bounds | Yes | |
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
Do two bounding boxes intersect.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
bBounds | Bounds | Yes |
intersects
Do two bounding boxes intersect.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
bBounds | Bounds | Yes |
isValid
Tests whether a given bounds is valid.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
isValid
Tests whether a given bounds is valid.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
reset
Resets a bounds to infinity.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
reset
Resets a bounds to infinity.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes |
scale
Scales a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
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 |
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 a bounding box from another bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
other | 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 a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
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 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 a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
x | number | Yes | |
y | number | Yes | |
z | number | Yes |
transformBounds
Transforms a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
transform | mat4 | Yes | |
out | Bounds | Yes |
transformBounds
Transforms a bounding box.
| Argument | Type | Required | Description |
|---|---|---|---|
bounds | Bounds | Yes | |
transform | mat4 | Yes | |
out | Bounds | Yes |