|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
Signed distance field for an ellipsoid with its semi-axes along x, y and z. More...
#include <EBGeometry_AnalyticDistanceFunctions.hpp>
Public Member Functions | |
| EllipsoidSDF ()=default | |
| Default constructor. Constructs the unit sphere at the origin. | |
| EllipsoidSDF (const Vec3T< T > &a_center, const Vec3T< T > &a_radii) | |
| Full constructor. | |
| EllipsoidSDF (const EllipsoidSDF &)=default | |
| Copy constructor. | |
| EllipsoidSDF (EllipsoidSDF &&)=default | |
| Move constructor. | |
| EllipsoidSDF & | operator= (const EllipsoidSDF &)=default |
| Copy assignment. | |
| EllipsoidSDF & | operator= (EllipsoidSDF &&)=default |
| Move assignment. | |
| const Vec3T< T > & | getCenter () const noexcept |
| Get the center. | |
| const Vec3T< T > & | getRadii () const noexcept |
| Get the semi-axes. | |
| T | signedDistance (const Vec3T< T > &a_point) const noexcept |
| Signed distance function for the ellipsoid. | |
| BoundingVolumes::AABBT< T > | computeBoundingVolume () const noexcept |
| The shape's axis-aligned bounding box. | |
Static Public Attributes | |
| static constexpr DistanceQuality | distanceQuality = DistanceQuality::Exact |
| How far signedDistance() can be trusted as a distance: the Euclidean distance to the surface. | |
Protected Attributes | |
| Vec3T< T > | m_center = Vec3T<T>::zeros() |
| Center. | |
| Vec3T< T > | m_radii = Vec3T<T>::ones() |
| Semi-axes along x, y and z. | |
Signed distance field for an ellipsoid with its semi-axes along x, y and z.
The value is the exact signed distance. There is no closed form for it: the closest point on the surface is the root of a scalar equation (Eberly, "Distance from a point to an ellipse, an ellipsoid, or a hyperellipsoid", 2013), found by safeguarded Newton steps from a bracket, a few iterations for most points and at most 64. An ellipsoid therefore costs several times as much to evaluate as the other shapes here. The common formula |p / r| (|p / r| - 1) / |p / r^2| is cheaper, but it can overestimate the distance, which a DistanceQuality::Bound may not. Turn the ellipsoid with Rotate. By default the ellipsoid is the unit sphere at the origin.
| T | Floating-point precision. |
|
inline |
Full constructor.
| [in] | a_center | Center. |
| [in] | a_radii | The semi-axes along x, y and z, each finite and positive. |
|
inlinenoexcept |
The shape's axis-aligned bounding box.
|
inlinenoexcept |
Get the center.
|
inlinenoexcept |
Get the semi-axes.
|
default |
Copy assignment.
|
default |
Move assignment.
|
inlinenoexcept |
Signed distance function for the ellipsoid.
The point is folded into the first octant and the axes sorted from largest to smallest, as Eberly's algorithm takes them.
| [in] | a_point | Position. |