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::CylinderSDF< T > Class Template Reference

Signed distance field for a finite, flat-capped cylinder. More...

#include <EBGeometry_AnalyticDistanceFunctions.hpp>

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

Public Member Functions

 CylinderSDF ()=default
 Default constructor. Constructs a unit cylinder of radius 1 and height 1, centred at the origin with its axis along y (cap centres at (0,-0.5,0) and (0,0.5,0)).
 
 CylinderSDF (const Vec3T< T > &a_center1, const Vec3T< T > &a_center2, const T &a_radius) noexcept
 Full constructor.
 
 CylinderSDF (const CylinderSDF &)=default
 Copy constructor.
 
 CylinderSDF (CylinderSDF &&)=default
 Move constructor.
 
CylinderSDFoperator= (const CylinderSDF &)=default
 Copy assignment.
 
CylinderSDFoperator= (CylinderSDF &&)=default
 Move assignment.
 
 ~CylinderSDF () override=default
 Destructor.
 
const Vec3T< T > & getCenter1 () const noexcept
 Get one endpoint.
 
const Vec3T< T > & getCenter2 () const noexcept
 Get the other endpoint.
 
const T & getRadius () const noexcept
 Get radius.
 
signedDistance (const Vec3T< T > &a_point) const noexcept override
 Signed distance function for the 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

Vec3T< T > m_center1 = Vec3T<T>(T(0), T(-0.5), T(0))
 One endpoint (cap center).
 
Vec3T< T > m_center2 = Vec3T<T>(T(0), T(0.5), T(0))
 Other endpoint (cap center).
 
Vec3T< T > m_center = Vec3T<T>::zeros()
 Midpoint of m_center1 and m_center2.
 
Vec3T< T > m_axis = Vec3T<T>(T(0), T(1), T(0))
 Unit axis pointing from m_center1 to m_center2.
 
m_length = T(1)
 Distance between the two endpoints.
 
m_radius = T(1)
 Cylinder radius.
 

Detailed Description

template<class T>
class EBGeometry::CylinderSDF< T >

Signed distance field for a finite, flat-capped cylinder.

The cylinder is defined by two cap-centre positions m_center1 and m_center2 and a radius m_radius. The cylinder axis is the unit vector from m_center1 to m_center2, and its height (distance between the two flat caps) equals distance(m_center1, m_center2). The SDF is negative inside the cylinder and positive outside. By default the cylinder has radius 1 and height 1, centred at the origin with its axis along y (cap centres at (0,-0.5,0) and (0,0.5,0)).

Template Parameters
TFloating-point precision.

Constructor & Destructor Documentation

◆ CylinderSDF()

template<class T >
EBGeometry::CylinderSDF< T >::CylinderSDF ( const Vec3T< T > &  a_center1,
const Vec3T< T > &  a_center2,
const T &  a_radius 
)
inlinenoexcept

Full constructor.

Parameters
[in]a_center1One endpoint (cap center).
[in]a_center2Other endpoint (cap center).
[in]a_radiusCylinder radius.

Member Function Documentation

◆ getCenter1()

template<class T >
const Vec3T< T > & EBGeometry::CylinderSDF< T >::getCenter1 ( ) const
inlinenoexcept

Get one endpoint.

Returns
m_center1

◆ getCenter2()

template<class T >
const Vec3T< T > & EBGeometry::CylinderSDF< T >::getCenter2 ( ) const
inlinenoexcept

Get the other endpoint.

Returns
m_center2

◆ getRadius()

template<class T >
const T & EBGeometry::CylinderSDF< T >::getRadius ( ) const
inlinenoexcept

Get radius.

Returns
m_radius.

◆ operator=() [1/2]

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

Copy assignment.

Returns
Reference to (*this).

◆ operator=() [2/2]

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

Move assignment.

Returns
Reference to (*this).

◆ signedDistance()

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

Signed distance function for the cylinder.

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

Implements EBGeometry::SignedDistanceFunction< T >.


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