Bounding sphere defined by a center point and radius.
More...
#include <BoundingVolumes.h>
|
| constexpr bool | Intersects (const BoundingSphere &other) const |
| | Tests whether this sphere overlaps another sphere.
|
| constexpr bool | Intersects (const AABB &aabb) const |
| | Tests whether this sphere overlaps an AABB.
|
| constexpr bool | Contains (const vec3 &point) const |
| | Tests whether a point lies inside or on the surface of this sphere.
|
Bounding sphere defined by a center point and radius.
◆ Contains()
| bool Crux::BoundingSphere::Contains |
( |
const vec3 & | point | ) |
const |
|
inlineconstexpr |
Tests whether a point lies inside or on the surface of this sphere.
- Parameters
-
- Returns
- True if the squared distance from the center to
point is within the squared radius.
◆ FromAABB()
Constructs the smallest bounding sphere enclosing the given AABB.
- Parameters
-
- Returns
- A sphere centered at the AABB center with radius equal to the half-diagonal.
◆ FromCenterRadius()
| constexpr BoundingSphere Crux::BoundingSphere::FromCenterRadius |
( |
const vec3 & | center, |
|
|
f32 | radius ) |
|
inlinestaticconstexpr |
Constructs a bounding sphere from an explicit center and radius.
- Parameters
-
| center | The center of the sphere. |
| radius | The radius of the sphere. |
- Returns
- A BoundingSphere with the given center and radius.
◆ Intersects() [1/2]
| bool Crux::BoundingSphere::Intersects |
( |
const AABB & | aabb | ) |
const |
|
inlineconstexpr |
Tests whether this sphere overlaps an AABB.
- Parameters
-
| aabb | The AABB to test against. |
- Returns
- True if the closest point on the AABB to the sphere center is within the radius.
◆ Intersects() [2/2]
| bool Crux::BoundingSphere::Intersects |
( |
const BoundingSphere & | other | ) |
const |
|
inlineconstexpr |
Tests whether this sphere overlaps another sphere.
Uses squared distance to avoid a sqrt.
- Parameters
-
| other | The sphere to test against. |
- Returns
- True if the distance between centers is less than or equal to the sum of radii.
◆ Center
| vec3 Crux::BoundingSphere::Center {0.0f, 0.0f, 0.0f} |
◆ Radius
| f32 Crux::BoundingSphere::Radius {0.0f} |
The documentation for this struct was generated from the following file: