EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
EBGeometry::RoundedCylinderSDF< T > Class Template Reference

Signed distance field for a cylinder with rounded (toroidal) edges. More...

#include <EBGeometry_AnalyticDistanceFunctions.hpp>

Inheritance diagram for EBGeometry::RoundedCylinderSDF< T >:
Inheritance graph
[legend]
Collaboration diagram for EBGeometry::RoundedCylinderSDF< T >:
Collaboration graph
[legend]

Public Member Functions

 RoundedCylinderSDF ()=default
 Default constructor. Constructs a rounded cylinder centred at the origin, axis along y, with outer radius 1, total height 1, and edge curvature 0.1.
 
 RoundedCylinderSDF (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.
 
RoundedCylinderSDFoperator= (const RoundedCylinderSDF &)=default
 Copy assignment.
 
RoundedCylinderSDFoperator= (RoundedCylinderSDF &&)=default
 Move assignment.
 
 ~RoundedCylinderSDF () override=default
 Destructor.
 
signedDistance (const Vec3T< T > &a_point) const noexcept override
 Signed distance function for the rounded cylinder.
 
- Public Member Functions inherited from EBGeometry::SignedDistanceFunction< T >
 SignedDistanceFunction ()=default
 Default constructor.
 
 ~SignedDistanceFunction () override=default
 Destructor.
 
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.
 
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

m_majorRadius = T(0.9)
 Inner cylinder radius (= outer radius - curvature).
 
m_minorRadius = T(0.1)
 Edge rounding radius (= curvature).
 
m_height = T(0.4)
 Inner half-height (= 0.5*height - curvature).
 

Detailed Description

template<class T>
class EBGeometry::RoundedCylinderSDF< T >

Signed distance field for a cylinder with rounded (toroidal) edges.

The cylinder is centred at the origin with its axis along y. The constructor takes the outer radius, the total height, and an edge curvature radius. 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:

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).

Template Parameters
TFloating-point precision.

Constructor & Destructor Documentation

◆ RoundedCylinderSDF()

template<class T >
EBGeometry::RoundedCylinderSDF< T >::RoundedCylinderSDF ( const a_radius,
const a_curvature,
const a_height 
)
inlinenoexcept

Full constructor.

Parameters
[in]a_radiusOuter cylinder radius. Must be > 0 and > a_curvature.
[in]a_curvatureEdge rounding radius. Must be > 0 and satisfy a_curvature < a_radius and 2 * a_curvature < a_height.
[in]a_heightTotal cylinder height. Must be > 0 and > 2 * a_curvature.

Member Function Documentation

◆ operator=() [1/2]

template<class T >
RoundedCylinderSDF & EBGeometry::RoundedCylinderSDF< T >::operator= ( const RoundedCylinderSDF< T > &  )
default

Copy assignment.

Returns
Reference to (*this).

◆ operator=() [2/2]

template<class T >
RoundedCylinderSDF & EBGeometry::RoundedCylinderSDF< T >::operator= ( RoundedCylinderSDF< T > &&  )
default

Move assignment.

Returns
Reference to (*this).

◆ signedDistance()

template<class T >
T EBGeometry::RoundedCylinderSDF< T >::signedDistance ( const Vec3T< T > &  a_point) const
inlineoverridevirtualnoexcept

Signed distance function for the rounded cylinder.

Parameters
[in]a_pointPosition.
Returns
Signed distance from a_point to the rounded-cylinder surface; negative inside.

Implements EBGeometry::SignedDistanceFunction< T >.


The documentation for this class was generated from the following file: