|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
Signed distance field for a cylinder with rounded (toroidal) edges. More...
#include <EBGeometry_AnalyticDistanceFunctions.hpp>
Public Member Functions | |
| RoundedCylinderSDF ()=default | |
| Default constructor. Constructs a rounded cylinder centered at the origin, axis along y, with outer radius 1, total height 1, and edge curvature 0.1. | |
| RoundedCylinderSDF (const Vec3T< T > &a_center, const T a_radius, const T a_curvature, const T a_height) noexcept | |
| Full constructor. | |
| RoundedCylinderSDF (const RoundedCylinderSDF &)=default | |
| Copy constructor. | |
| RoundedCylinderSDF (RoundedCylinderSDF &&)=default | |
| Move constructor. | |
| RoundedCylinderSDF & | operator= (const RoundedCylinderSDF &)=default |
| Copy assignment. | |
| RoundedCylinderSDF & | operator= (RoundedCylinderSDF &&)=default |
| Move assignment. | |
| T | signedDistance (const Vec3T< T > &a_point) const noexcept |
| Signed distance function for the rounded cylinder. | |
| 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() |
| Cylinder center. | |
| T | m_majorRadius = T(0.9) |
| Inner cylinder radius (= outer radius - curvature). | |
| T | m_minorRadius = T(0.1) |
| Edge rounding radius (= curvature). | |
| T | m_height = T(0.4) |
| Inner half-height (= 0.5*height - curvature). | |
Signed distance field for a cylinder with rounded (toroidal) edges.
The cylinder is centered at m_center with its axis along y. The constructor takes the center, the outer radius, the edge curvature radius and the total height. The curvature rounds the sharp edges where the flat caps meet the cylindrical wall; the resulting shape is sometimes called a "stadium of revolution" or a "pill cylinder".
Internally three derived parameters are stored:
m_majorRadius = a_radius - a_curvature: radius of the inner cylindrical core (before edge rounding).m_minorRadius = a_curvature: radius of the torus-like edge rounding.m_height = 0.5 * a_height - a_curvature: half-height of the inner cylindrical core (before edge rounding).The outer bounding cylinder has radius m_majorRadius + m_minorRadius = a_radius and half-height m_height + m_minorRadius = 0.5 * a_height. For the geometry to be valid, a_curvature must be strictly less than a_radius and less than 0.5 * a_height.
The SDF is negative inside and positive outside. By default the cylinder has outer radius 1, height 1, and edge curvature 0.1 (stored as m_majorRadius=0.9, m_minorRadius=0.1, m_height=0.4).
| T | Floating-point precision. |
|
inlinenoexcept |
Full constructor.
| [in] | a_center | Cylinder center. |
| [in] | a_radius | Outer cylinder radius. Must be > 0 and > a_curvature. |
| [in] | a_curvature | Edge rounding radius. Must be > 0 and satisfy a_curvature < a_radius and 2 * a_curvature < a_height. |
| [in] | a_height | Total cylinder height. Must be > 0 and > 2 * a_curvature. |
|
inlinenoexcept |
The shape's axis-aligned bounding box.
The outer radius either side of the axis in x and z, and half the height in y.
|
default |
Copy assignment.
|
default |
Move assignment.
|
inlinenoexcept |
Signed distance function for the rounded cylinder.
| [in] | a_point | Position. |