11#ifndef EBGEOMETRY_BOUNDINGVOLUMES_HPP
12#define EBGEOMETRY_BOUNDINGVOLUMES_HPP
28namespace BoundingVolumes {
37 static_assert(std::is_floating_point_v<T>,
"SphereT<T>: T must be a floating-point type.");
49 os <<
'(' <<
sphere.getCentroid() <<
", " <<
sphere.getRadius() <<
')';
248 static_assert(std::is_floating_point_v<T>,
"AABBT<T>: T must be a floating-point type.");
260 os <<
'(' <<
aabb.getLowCorner() <<
", " <<
aabb.getHighCorner() <<
')';
486#include "EBGeometry_BoundingVolumesImplem.hpp"
Utility macros for EBGeometry.
Declaration of 2D and 3D point/vector classes with templated precision. Used with DCEL tools.
Axis-aligned bounding box (AABB) enclosing a set of 3D points.
Definition EBGeometry_BoundingVolumes.hpp:247
AABBT() noexcept=default
Default constructor. Sets lo = +∞, hi = −∞ (inverted sentinel).
Bounding sphere — an approximation to the smallest sphere enclosing a set of 3D points.
Definition EBGeometry_BoundingVolumes.hpp:36
bool intersects(const SphereT &a_other) const noexcept
Test whether this bounding sphere intersects a_other.
SphereT() noexcept=default
Default constructor. Sets radius to -1 (invalid sentinel).
friend std::ostream & operator<<(std::ostream &os, const SphereT< T > &sphere)
Output a bounding sphere to a stream in the form "(centroid, radius)".
Definition EBGeometry_BoundingVolumes.hpp:47
Vec3 m_center
Sphere centre. Initialised to the origin.
Definition EBGeometry_BoundingVolumes.hpp:229
void define(const std::vector< Vec3T< P > > &a_points, const BuildAlgorithm &a_alg) noexcept
Fit this sphere to a set of 3D points using the specified algorithm.
T getArea() const noexcept
Compute the sphere surface area (4 * pi * r^2).
Vec3 & getCentroid() noexcept
Get a modifiable reference to the sphere centroid.
T getVolume() const noexcept
Compute the sphere volume (4/3 * pi * r^3).
T getOverlappingVolume(const SphereT< T > &a_other) const noexcept
Compute the overlapping volume between this sphere and a_other.
T m_radius
Sphere radius. Initialised to -1 (invalid sentinel).
Definition EBGeometry_BoundingVolumes.hpp:224
T getDistance(const Vec3 &a_x0) const noexcept
Compute the unsigned distance from a_x0 to this sphere.
void buildRitter(const std::vector< Vec3T< P > > &a_points) noexcept
Fit a bounding sphere to a_points using Ritter's algorithm.
T getDistance2(const Vec3 &a_x0) const noexcept
Compute the squared unsigned distance from a_x0 to this sphere.
BuildAlgorithm
Algorithm used to compute a bounding sphere for a set of 3D points.
Definition EBGeometry_BoundingVolumes.hpp:58
@ Ritter
Ritter's simple two-pass approximation. Fast but may overestimate the radius slightly.
T & getRadius() noexcept
Get a modifiable reference to the sphere radius.
Three-dimensional vector class with arithmetic operators.
Definition EBGeometry_Vec.hpp:225
Namespace containing all of EBGeometry's functionality.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:31