Signed distance field for a capsule (pill shape): a cylinder capped with hemispheres.
More...
|
| | 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) |
| | 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.
|
| |
| T | signedDistance (const Vec3T< T > &a_point) const noexcept |
| | Signed distance function for the capsule.
|
| |
| uint32_t | getNumParts () const noexcept |
| | How many parts the shape has (see hasParts): 3.
|
| |
| uint32_t | closestPart (const Vec3T< T > &a_point) const noexcept |
| | The part whose term decides the value at a point (see hasParts): 0 the side, 1 the hemisphere at the first tip, 2 the one at the second.
|
| |
| BoundingVolumes::AABBT< T > | computeBoundingVolume () const noexcept |
| | The shape's axis-aligned bounding box.
|
| |
| const Vec3T< T > & | getCenter1 () const noexcept |
| | Get the center of the first hemispherical cap.
|
| |
| const Vec3T< T > & | getCenter2 () const noexcept |
| | Get the center of the second hemispherical cap.
|
| |
| const T & | getRadius () const noexcept |
| | Get the radius.
|
| |
template<class T>
class EBGeometry::CapsuleSDF< T >
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 centers 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 centered 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.
- Template Parameters
-
| T | Floating-point precision. |
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, centered at origin. The stored hemisphere centers are at (0,-0.5,0) and (0,0.5,0).