IGLBoundingBox
Module: core
Axis-aligned 3D bounding box for mesh, geometry, and finite-element spatial queries.
The bounding box is defined by minimum and maximum coordinates along
the X, Y, and Z axes. It is used for operations such as containment
tests, bounding radius calculation, and box union.
__init__
method
__init__(self, xmin: float, xmax: float, ymin: float, ymax: float, zmin: float, zmax: float)
Initialize the bounding box with axis-aligned extents.
Args
| Name | Type | Description |
|---|---|---|
| xmin | Minimum X coordinate. | |
| xmax | Maximum X coordinate. | |
| ymin | Minimum Y coordinate. | |
| ymax | Maximum Y coordinate. | |
| zmin | Minimum Z coordinate. | |
| zmax | Maximum Z coordinate. |
SetLimits
method
SetLimits(self, xmin: float, xmax: float, ymin: float, ymax: float, zmin: float, zmax: float)
Set the bounding box extents along each axis.
Args
| Name | Type | Description |
|---|---|---|
| xmin | New minimum X coordinate. | |
| xmax | New maximum X coordinate. | |
| ymin | New minimum Y coordinate. | |
| ymax | New maximum Y coordinate. | |
| zmin | New minimum Z coordinate. | |
| zmax | New maximum Z coordinate. |
GetLimits
method
GetLimits(self)
Return the current axis-aligned extents of the bounding box.
Returns
A tuple containing (xmin, xmax, ymin, ymax, zmin, zmax).
GetLength
method
GetLength(self)
Return the size of the bounding box along each axis.
Returns
A tuple containing the length in X, Y, and Z directions.
GetLimitsMaxMin
method
GetLimitsMaxMin(self)
Return the bounding box limits as maximum and minimum coordinate vectors.
Returns
A tuple containing two lists:
- vmax: [xmax, ymax, zmax]
- vmin: [xmin, ymin, zmin]
XMin
method
XMin(self)
Return the minimum X coordinate.
XMax
method
XMax(self)
Return the maximum X coordinate.
YMin
method
YMin(self)
Return the minimum Y coordinate.
YMax
method
YMax(self)
Return the maximum Y coordinate.
ZMin
method
ZMin(self)
Return the minimum Z coordinate.
ZMax
method
ZMax(self)
Return the maximum Z coordinate.
Center
method
Center(self)
Compute the center point of the bounding box.
Returns
A list containing [cx, cy, cz], the centroid of the box.
BoundingRadius
method
BoundingRadius(self)
Compute the radius of the bounding sphere enclosing the box.
The radius is half the diagonal length of the axis-aligned box.
The radius is half the diagonal length of the axis-aligned box.
Returns
The bounding sphere radius.
Contains
method
Contains(self, P: _Point3D)
Test whether a 3D point lies within the bounding box.
Args
| Name | Type | Description |
|---|---|---|
| P | Point object implementing GetX, GetY, and GetZ. |
Returns
True if the point is inside or on the boundary of the box.
AddBox
method
AddBox(self, other: "IGLBoundingBox")
Expand this bounding box to include another box.
Args
| Name | Type | Description |
|---|---|---|
| other | Another bounding box whose extents should be merged. |
IsValid
method
IsValid(self)
Check whether the bounding box has valid extents.
Returns
True if min coordinates are less than or equal to max coordinates
for all axes.
__repr__
method
__repr__(self)