|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
Signed distance field for a superellipsoid (Barr's superquadric): from an ellipsoid to a rounded box, and toward a box or an octahedron, with its semi-axes along x, y and z. More...
#include <EBGeometry_AnalyticDistanceFunctions.hpp>
Public Member Functions | |
| SuperellipsoidSDF ()=default | |
| Default constructor. Constructs a superellipsoid at the origin, with semi-axes 1 and both exponents 0.5. | |
| SuperellipsoidSDF (const Vec3T< T > &a_center, const Vec3T< T > &a_radii, const T a_exponent1, const T a_exponent2) | |
| Full constructor. | |
| SuperellipsoidSDF (const SuperellipsoidSDF &)=default | |
| Copy constructor. | |
| SuperellipsoidSDF (SuperellipsoidSDF &&)=default | |
| Move constructor. | |
| SuperellipsoidSDF & | operator= (const SuperellipsoidSDF &)=default |
| Copy assignment. | |
| SuperellipsoidSDF & | operator= (SuperellipsoidSDF &&)=default |
| Move assignment. | |
| const Vec3T< T > & | getCenter () const noexcept |
| Get the center. | |
| const Vec3T< T > & | getRadii () const noexcept |
| Get the semi-axes. | |
| T | gauge (const Vec3T< T > &a_point) const noexcept |
| The superquadric's gauge at a point: below 1 inside, 1 on the surface, above 1 outside. | |
| T | signedDistance (const Vec3T< T > &a_point) const noexcept |
| Signed distance function for the superellipsoid: a bound. | |
| BoundingVolumes::AABBT< T > | computeBoundingVolume () const noexcept |
| The shape's axis-aligned bounding box: the center plus and minus the semi-axes. | |
Static Public Attributes | |
| static constexpr DistanceQuality | distanceQuality = DistanceQuality::Bound |
| How far signedDistance() can be trusted as a distance: never more than the Euclidean distance. | |
Protected Attributes | |
| Vec3T< T > | m_center = Vec3T<T>::zeros() |
| Center. | |
| Vec3T< T > | m_radii = Vec3T<T>::ones() |
| Semi-axes. | |
| T | m_exponent1 = T(0.5) |
| The exponent through the y axis. | |
| T | m_exponent2 = T(0.5) |
| The exponent across it. | |
| T | m_scale = T(1) |
| One over the gauge's largest slope. | |
Signed distance field for a superellipsoid (Barr's superquadric): from an ellipsoid to a rounded box, and toward a box or an octahedron, with its semi-axes along x, y and z.
The surface is (|x/a|^(2/e2) + |z/c|^(2/e2))^(e2/e1) + |y/b|^(2/e1) = 1 around the center: e1 shapes the cross-sections through the y axis, e2 those across it. Both exponents are in [0.1, 2], where the solid is convex: 1 gives an ellipsoid, toward 0.1 a box, 2 an octahedron (a double cone where only one is 2). The value is a bound: the superquadric's gauge (the left side above, to the power e1 / 2, which is a norm of the scaled point) less 1, divided by the gauge's largest slope, so that it never exceeds the distance. Far from the surface, and for unequal semi-axes, it is well below it. Turn it with Rotate. By default the superellipsoid is centered at the origin, with semi-axes 1 and both exponents 0.5.
| T | Floating-point precision. |
|
inline |
Full constructor.
| [in] | a_center | Center. |
| [in] | a_radii | Semi-axes along x, y and z, finite and positive. |
| [in] | a_exponent1 | The exponent e1 of the cross-sections through the y axis, in [0.1, 2]. |
| [in] | a_exponent2 | The exponent e2 of the cross-sections across it, in [0.1, 2]. |
|
inlinenoexcept |
The shape's axis-aligned bounding box: the center plus and minus the semi-axes.
|
inlinenoexcept |
The superquadric's gauge at a point: below 1 inside, 1 on the surface, above 1 outside.
Out of line on a device (the superellipsoid's solver): inlined, it would be copied into every level of every tape kernel, whatever shapes the tape holds, which makes the device compile of every tape kernel much slower. A call costs little beside its powers.
| [in] | a_point | Position. |
|
inlinenoexcept |
Get the center.
|
inlinenoexcept |
Get the semi-axes.
|
default |
Copy assignment.
|
default |
Move assignment.
|
inlinenoexcept |
Signed distance function for the superellipsoid: a bound.
| [in] | a_point | Position. |