A bounding sphere with a center and a radius.
More...
#include <CesiumGeometry/BoundingSphere.h>
|
| constexpr | BoundingSphere (const glm::dvec3 ¢er, double radius) noexcept |
| | Construct a new instance.
|
| |
| constexpr const glm::dvec3 & | getCenter () const noexcept |
| | Gets the center of the bounding sphere.
|
| |
| constexpr double | getRadius () const noexcept |
| | Gets the radius of the bounding sphere.
|
| |
| CullingResult | intersectPlane (const Plane &plane) const noexcept |
| | Determines on which side of a plane this boundings sphere is located.
|
| |
| double | computeDistanceSquaredToPosition (const glm::dvec3 &position) const noexcept |
| | Computes the distance squared from a position to the closest point on this bounding sphere. Returns 0 if the point is inside the sphere.
|
| |
| bool | contains (const glm::dvec3 &position) const noexcept |
| | Computes whether the given position is contained within the bounding sphere.
|
| |
| BoundingSphere | transform (const glm::dmat4 &transformation) const noexcept |
| | Transforms this bounding sphere to another coordinate system using a 4x4 matrix.
|
| |
A bounding sphere with a center and a radius.
Definition at line 16 of file BoundingSphere.h.
◆ BoundingSphere()
| CesiumGeometry::BoundingSphere::BoundingSphere |
( |
const glm::dvec3 & | center, |
|
|
double | radius ) |
|
inlineconstexprnoexcept |
Construct a new instance.
- Parameters
-
| center | The center of the bounding sphere. |
| radius | The radius of the bounding sphere. |
Definition at line 24 of file BoundingSphere.h.
◆ computeDistanceSquaredToPosition()
| double CesiumGeometry::BoundingSphere::computeDistanceSquaredToPosition |
( |
const glm::dvec3 & | position | ) |
const |
|
noexcept |
Computes the distance squared from a position to the closest point on this bounding sphere. Returns 0 if the point is inside the sphere.
- Parameters
-
- Returns
- The distance squared from the position to the closest point on this bounding sphere.
glm::dvec3 cameraPosition = anyOldCameraPosition();
std::vector<BoundingSphere> spheres = anyOldSphereArray();
std::sort(
spheres.begin(),
spheres.end(),
[&cameraPosition](auto& a, auto& b) {
return a.computeDistanceSquaredToPosition(cameraPosition) >
b.computeDistanceSquaredToPosition(cameraPosition);
});
◆ contains()
| bool CesiumGeometry::BoundingSphere::contains |
( |
const glm::dvec3 & | position | ) |
const |
|
noexcept |
Computes whether the given position is contained within the bounding sphere.
- Parameters
-
- Returns
- Whether the position is contained within the bounding sphere.
◆ getCenter()
| const glm::dvec3 & CesiumGeometry::BoundingSphere::getCenter |
( |
| ) |
const |
|
inlineconstexprnoexcept |
◆ getRadius()
| double CesiumGeometry::BoundingSphere::getRadius |
( |
| ) |
const |
|
inlineconstexprnoexcept |
◆ intersectPlane()
Determines on which side of a plane this boundings sphere is located.
- Parameters
-
| plane | The plane to test against. |
- Returns
-
◆ transform()
| BoundingSphere CesiumGeometry::BoundingSphere::transform |
( |
const glm::dmat4 & | transformation | ) |
const |
|
noexcept |
Transforms this bounding sphere to another coordinate system using a 4x4 matrix.
If the transformation has non-uniform scale, the bounding sphere's radius is scaled by the largest scale value among the transformation's axes.
- Parameters
-
| transformation | The transformation. |
- Returns
- The bounding sphere 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/BoundingSphere.h