py3dtiles.tileset.bounding_volume_box module
- class py3dtiles.tileset.bounding_volume_box.BoundingVolumeBox[source]
Bases:
BoundingVolume
[BoundingVolumeBoxDictType
]A box bounding volume as defined in the 3DTiles specifications i.e. an array of 12 numbers that define an oriented bounding box:
The first three elements define the x, y, and z values for the center of the box.
The next three elements (with indices 3, 4, and 5) define the x axis direction and half-length.
The next three elements (with indices 6, 7, and 8) define the y axis direction and half-length.
The last three elements (indices 9, 10, and 11) define the z axis direction and half-length.
Note that, by default, a box bounding volume doesn’t need to be aligned with the coordinate axis. Still in general, computing the box bounding volume of two box bounding volumes won’t necessarily yield a box that is aligned with the coordinate axis (although this computation might require some fitting algorithm e.g. the principal component analysis method. Yet in sake of simplification (and numerical efficiency), when asked to “add” (i.e. to find the enclosing box of) two (or more) box bounding volumes this class resolves to compute the “canonical” fitting/enclosing box i.e. a box that is parallel to the coordinate axis.
- add(other: BoundingVolume[Any]) None [source]
Compute the ‘canonical’ bounding volume fitting this bounding volume together with the added bounding volume. Again (refer above to the class definition) the computed fitting bounding volume is generically not the smallest one (due to its alignment with the coordinate axis).
- Parameters:
other – another box bounding volume to be added with this one
- classmethod from_dict(bounding_volume_box_dict: BoundingVolumeBoxDictType) Self [source]
Construct a BoundingVolumeBox from a dict following the structure of a 3dtiles bounding volume
- classmethod from_list(box_list: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) BoundingVolumeBox [source]
Construct a bounding box enclosing all the points.
Internally call set_from_points.
- Returns:
a new instance of BoundingVolumeBox
- classmethod from_points(points: list[ndarray[Any, dtype[float64]]]) BoundingVolumeBox [source]
Construct a bounding box enclosing all the points.
Internally call set_from_points.
- Returns:
a new instance of BoundingVolumeBox
- static get_box_array_from_mins_maxs(mins_maxs: ndarray[Any, dtype[float64]]) ndarray[Any, dtype[float64]] [source]
- Parameters:
mins_maxs – the list [x_min, y_min, z_min, x_max, y_max, z_max] that is the boundaries of the box along each coordinate axis
- Returns:
the smallest box (as an array, as opposed to a BoundingVolumeBox instance) that encloses the given list of (3D) points and that is parallel to the coordinate axis.
- static get_box_array_from_point(points: list[ndarray[Any, dtype[float64]]]) ndarray[Any, dtype[float64]] [source]
- Parameters:
points – a list of 3D points
- Returns:
the smallest box (as an array, as opposed to a BoundingVolumeBox instance) that encloses the given list of (3D) points and that is parallel to the coordinate axis.
- get_canonical_as_array() ndarray[Any, dtype[float64]] [source]
- Returns:
the smallest enclosing box (as an array) that is parallel to the coordinate axis
- get_corners() list[ndarray[Any, dtype[float64]]] [source]
- Returns:
the corners (3D points) of the box as a list
- set_from_list(box_list: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) None [source]
Set the box from a list of coordinates closely matching the 3Dtiles spec.
- Parameters:
box_list – An array of 12 numbers that define an oriented bounding box. The first three elements define the x, y, and z values for the center of the box. The next three elements (with indices 3, 4, and 5) define the x axis direction and half-length. The next three elements (indices 6, 7, and 8) define the y axis direction and half-length. The last three elements (indices 9, 10, and 11) define the z axis direction and half-length.
- set_from_mins_maxs(mins_maxs: ndarray[Any, dtype[float64]]) None [source]
Set the box from a min and a max.
- Parameters:
mins_maxs – the array [x_min, y_min, z_min, x_max, y_max, z_max] that is the boundaries of the box along each coordinate axis
- set_from_points(points: list[ndarray[Any, dtype[float64]]]) None [source]
Make the current box only include a list of points. Note: the box limits are replaced, not extended.
- Parameters:
points – An array of points
- to_dict() BoundingVolumeBoxDictType [source]