|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
Signed distance field for a capsule (pill shape): a cylinder capped with hemispheres. More...
#include <EBGeometry_AnalyticDistanceFunctions.hpp>


Public Member Functions | |
| CapsuleSDF ()=default | |
| Default constructor. Constructs a capsule with tips at (0,-1,0) and (0,1,0), radius 0.5. | |
| CapsuleSDF (const Vec3T< T > &a_tip1, const Vec3T< T > &a_tip2, const T &a_radius) noexcept | |
| Full constructor. | |
| CapsuleSDF (const CapsuleSDF &)=default | |
| Copy constructor. | |
| CapsuleSDF (CapsuleSDF &&)=default | |
| Move constructor. | |
| CapsuleSDF & | operator= (const CapsuleSDF &)=default |
| Copy assignment. | |
| CapsuleSDF & | operator= (CapsuleSDF &&)=default |
| Move assignment. | |
| ~CapsuleSDF () override=default | |
| Destructor. | |
| T | signedDistance (const Vec3T< T > &a_point) const noexcept override |
| Signed distance function for the capsule. | |
Public Member Functions inherited from EBGeometry::SignedDistanceFunction< T > | |
| SignedDistanceFunction ()=default | |
| Default constructor. | |
| ~SignedDistanceFunction () override=default | |
| Destructor. | |
| T | value (const Vec3T< T > &a_point) const noexcept final |
| Implementation of ImplicitFunction::value; delegates to signedDistance(). | |
| virtual Vec3T< T > | normal (const Vec3T< T > &a_point, const T &a_delta) const noexcept |
| Compute the outward normal using central finite differences. | |
Public Member Functions inherited from EBGeometry::ImplicitFunction< T > | |
| ImplicitFunction ()=default | |
| Default constructor. | |
| virtual | ~ImplicitFunction ()=default |
| Default destructor. | |
| T | operator() (const Vec3T< T > &a_point) const noexcept |
| Call operator — alternative signature for the value function. | |
| template<class BV > | |
| BV | approximateBoundingVolumeOctree (const Vec3T< T > &a_initialLowCorner, const Vec3T< T > &a_initialHighCorner, const unsigned int a_maxTreeDepth, const T &a_safety=0.0) const |
| Compute an approximation to the bounding volume for the implicit surface using octree subdivision. | |
Protected Attributes | |
| Vec3T< T > | m_center1 = Vec3T<T>(T(0), T(-0.5), T(0)) |
| Center of one hemispherical cap. | |
| Vec3T< T > | m_center2 = Vec3T<T>(T(0), T(0.5), T(0)) |
| Center of the other hemispherical cap. | |
| T | m_radius = T(0.5) |
| Capsule radius. | |
Signed distance field for a capsule (pill shape): a cylinder capped with hemispheres.
A capsule is defined by two outer tip positions and a radius. The tips are the outermost points of each hemispherical endcap. The total length (tip to tip) equals distance(tip1, tip2). The internal cylindrical body has length distance(tip1, tip2) - 2 * radius, and the two hemispheres each contribute a further radius to each end.
Internally the hemisphere centres are stored as m_center1 and m_center2 (inset from the tips by radius along the capsule axis). These are not the same as the tip positions passed to the constructor.
The SDF is negative inside the capsule and positive outside. By default the capsule is centred at the origin, aligned along y, with tips at (0,-1,0) and (0,1,0) and radius 0.5, giving a total height of 2 and a cylindrical body of length 1.
| T | Floating-point precision. |
|
default |
Default constructor. Constructs a capsule with tips at (0,-1,0) and (0,1,0), radius 0.5.
Total height = 2, cylindrical body length = 1, aligned along y, centred at origin. The stored hemisphere centres are at (0,-0.5,0) and (0,0.5,0).
|
inlinenoexcept |
Full constructor.
The hemisphere centres stored internally are derived from the tips: m_center1 = a_tip1 + a_radius * axis and m_center2 = a_tip2 - a_radius * axis, where axis = (a_tip2 - a_tip1) / distance(a_tip1, a_tip2). The cylindrical body length is distance(a_tip1, a_tip2) - 2 * a_radius; for a valid non-degenerate shape this must be positive, i.e. distance(a_tip1, a_tip2) > 2 * a_radius.
| [in] | a_tip1 | Outer tip of one hemispherical cap (outermost point in that direction). |
| [in] | a_tip2 | Outer tip of the other hemispherical cap. |
| [in] | a_radius | Capsule radius (applied to both the tube and the hemispherical caps). |
|
default |
Move assignment.
|
default |
Copy assignment.
|
inlineoverridevirtualnoexcept |
Signed distance function for the capsule.
| [in] | a_point | Position. |
Implements EBGeometry::SignedDistanceFunction< T >.