BoundSphere
The BoundSphere type defines a bounding sphere for 3D space, providing efficient spatial containment, expansion, and intersection logic. It supports initialization from points, bounding boxes, and other spheres, and offers utilities for validation, distance computation, radius growth, and spatial queries. The implementation prioritizes performance, precision, and flexibility with support for custom vector types.
#include <geometry/TellusimBounds.h>
BoundSpheref
Represents a BoundSphere using 32-bit floating-point precision.
BoundSphered
Represents a BoundSphere using 64-bit floating-point precision.
Variables
Type | Name | Description |
---|---|---|
Vector3 | center | Center. |
Type | radius | Radius. |
Constructors
BoundSphere()
BoundSphere(const BoundSphere &bs)
BoundSphere(const Vector3 &bb_min, const Vector3 &bb_max)
BoundSphere(const Vector3 &bs_center, Type bs_radius)
explicit BoundSphere(const BoundBox &bb)
explicit BoundSphere(const BoundBox<CType, CVector> &bb)
explicit BoundSphere(const BoundSphere<CType, CVector> &bs)
BoundSphere(const Vector3 *points, uint32_t num_points)
Methods
Clear bound sphere.
void clear()
Check bound sphere.
bool isValid() const
operator bool() const
Set bound box.
void set(const Vector3 &bb_min, const Vector3 &bb_max)
void set(const BoundBox &bb)
Set bound sphere.
void set(const Vector3 &bs_center, Type bs_radius)
void set(const BoundSphere &bs)
Set bound sphere.
void set(const Vector3 *points, uint32_t num_points)
Expand by point.
void expand(const Vector3 &point)
Expand by bound box.
void expand(const Vector3 &bb_min, const Vector3 &bb_max)
void expand(const BoundBox &bb)
Expand by bound sphere.
void expand(const Vector3 &bs_center, Type bs_radius)
void expand(const BoundSphere &bs)
Expand by minimal bounds.
void expand(const Vector3 &bb_min, const Vector3 &bb_max, const Vector3 &bs_center, Type bs_radius)
void expand(const BoundBox &bb, const BoundSphere &bs)
Expand radius by point.
void expandRadius(const Vector3 &point)
Expand radius by bound box.
void expandRadius(const Vector3 &bb_min, const Vector3 &bb_max)
void expandRadius(const BoundBox &bb)
Expand radius by bound sphere.
void expandRadius(const Vector3 &bs_center, Type bs_radius)
void expandRadius(const BoundSphere &bs)
Inside point.
bool inside(const Vector3 &point) const
Inside bound box.
bool inside(const Vector3 &bb_min, const Vector3 &bb_max) const
bool inside(const BoundBox &bb) const
Inside bound sphere.
bool inside(const Vector3 &bs_center, Type bs_radius) const
bool inside(const BoundSphere &bs) const
Signed distance to bound sphere.
Type distance(const Vector3 &point) const
To bound box.
Vector3 getMin() const
Vector3 getMax() const
Bound sphere parameters.
const Vector3 &getCenter() const
Type getRadius() const
Type getVolume() const
Operators
Matrix to bound sphere multiplication.
BoundSphere operator*(const Matrix4x3 &m, const BoundSphere &bs)
BoundSphere operator*(const Matrix4x4 &m, const BoundSphere &bs)
Comparison operators.
bool operator==(const BoundSphere &bs0, const BoundSphere &bs1)
bool operator!=(const BoundSphere &bs0, const BoundSphere &bs1)