A bounding volume defined as a closed and convex cuboid with any orientation.
More...
#include <CesiumGeometry/OrientedBoundingBox.h>
|
| | OrientedBoundingBox (const glm::dvec3 ¢er, const glm::dmat3 &halfAxes) noexcept |
| | Constructs a new instance.
|
| |
| constexpr const glm::dvec3 & | getCenter () const noexcept |
| | Gets the center of the box.
|
| |
| constexpr const glm::dmat3 & | getHalfAxes () const noexcept |
| | Gets the three orthogonal half-axes of the bounding box. Equivalently, the transformation matrix to rotate and scale a 2x2x2 cube centered at the origin.
|
| |
| constexpr const glm::dmat3 & | getInverseHalfAxes () const noexcept |
| | Gets the inverse transformation matrix, to rotate from world space to local space relative to the box.
|
| |
| constexpr const glm::dvec3 & | getLengths () const noexcept |
| | Gets the lengths of the box on each local axis respectively.
|
| |
| CullingResult | intersectPlane (const Plane &plane) const noexcept |
| | Determines on which side of a plane the bounding box is located.
|
| |
| double | computeDistanceSquaredToPosition (const glm::dvec3 &position) const noexcept |
| | Computes the distance squared from a given position to the closest point on this bounding volume. The bounding volume and the position must be expressed in the same coordinate system.
|
| |
| bool | contains (const glm::dvec3 &position) const noexcept |
| | Computes whether the given position is contained within the bounding box.
|
| |
| OrientedBoundingBox | transform (const glm::dmat4 &transformation) const noexcept |
| | Transforms this bounding box to another coordinate system using a 4x4 matrix.
|
| |
|
AxisAlignedBox | toAxisAligned () const noexcept |
| | Converts this oriented bounding box to an axis-aligned bounding box.
|
| |
|
BoundingSphere | toSphere () const noexcept |
| | Converts this oriented bounding box to a bounding sphere.
|
| |
A bounding volume defined as a closed and convex cuboid with any orientation.
- See also
- BoundingSphere
-
BoundingRegion
Definition at line 22 of file OrientedBoundingBox.h.
◆ OrientedBoundingBox()
| CesiumGeometry::OrientedBoundingBox::OrientedBoundingBox |
( |
const glm::dvec3 & | center, |
|
|
const glm::dmat3 & | halfAxes ) |
|
inlinenoexcept |
Constructs a new instance.
- Parameters
-
| center | The center of the box. |
| halfAxes | The three orthogonal half-axes of the bounding box. Equivalently, the transformation matrix to rotate and scale a 2x2x2 cube centered at the origin. |
glm::dvec3 center = glm::dvec3(1.0, 0.0, 0.0);
glm::dmat3 halfAxes = glm::dmat3(
glm::dvec3(1.0, 0.0, 0.0),
glm::dvec3(0.0, 3.0, 0.0),
glm::dvec3(0.0, 0.0, 2.0));
Definition at line 34 of file OrientedBoundingBox.h.
◆ computeDistanceSquaredToPosition()
| double CesiumGeometry::OrientedBoundingBox::computeDistanceSquaredToPosition |
( |
const glm::dvec3 & | position | ) |
const |
|
noexcept |
Computes the distance squared from a given position to the closest point on this bounding volume. The bounding volume and the position must be expressed in the same coordinate system.
- Parameters
-
- Returns
- The estimated distance squared from the bounding box to the point.
glm::dvec3 cameraPosition = anyOldCameraPosition();
std::vector<OrientedBoundingBox> boxes = anyOldBoxArray();
std::sort(boxes.begin(), boxes.end(), [&cameraPosition](auto& a, auto& b) {
return a.computeDistanceSquaredToPosition(cameraPosition) >
b.computeDistanceSquaredToPosition(cameraPosition);
});
◆ contains()
| bool CesiumGeometry::OrientedBoundingBox::contains |
( |
const glm::dvec3 & | position | ) |
const |
|
noexcept |
Computes whether the given position is contained within the bounding box.
- Parameters
-
- Returns
- Whether the position is contained within the bounding box.
◆ getCenter()
| const glm::dvec3 & CesiumGeometry::OrientedBoundingBox::getCenter |
( |
| ) |
const |
|
inlineconstexprnoexcept |
◆ getHalfAxes()
| const glm::dmat3 & CesiumGeometry::OrientedBoundingBox::getHalfAxes |
( |
| ) |
const |
|
inlineconstexprnoexcept |
Gets the three orthogonal half-axes of the bounding box. Equivalently, the transformation matrix to rotate and scale a 2x2x2 cube centered at the origin.
Definition at line 58 of file OrientedBoundingBox.h.
◆ getInverseHalfAxes()
| const glm::dmat3 & CesiumGeometry::OrientedBoundingBox::getInverseHalfAxes |
( |
| ) |
const |
|
inlineconstexprnoexcept |
Gets the inverse transformation matrix, to rotate from world space to local space relative to the box.
Definition at line 66 of file OrientedBoundingBox.h.
◆ getLengths()
| const glm::dvec3 & CesiumGeometry::OrientedBoundingBox::getLengths |
( |
| ) |
const |
|
inlineconstexprnoexcept |
◆ intersectPlane()
| CullingResult CesiumGeometry::OrientedBoundingBox::intersectPlane |
( |
const Plane & | plane | ) |
const |
|
noexcept |
Determines on which side of a plane the bounding box is located.
- Parameters
-
| plane | The plane to test against. |
- Returns
-
◆ transform()
| OrientedBoundingBox CesiumGeometry::OrientedBoundingBox::transform |
( |
const glm::dmat4 & | transformation | ) |
const |
|
noexcept |
Transforms this bounding box to another coordinate system using a 4x4 matrix.
- Parameters
-
| transformation | The transformation. |
- Returns
- The oriented bounding box in the new coordinate system.
The documentation for this class was generated from the following file:
- /home/runner/work/cesium-native/cesium-native/CesiumGeometry/include/CesiumGeometry/OrientedBoundingBox.h