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

Signed distance field for a finite cone. More...

#include <EBGeometry_AnalyticDistanceFunctions.hpp>

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

Public Member Functions

 ConeSDF ()=default
 Default constructor. Constructs a finite cone with its tip at the origin, height 1, and a 45-degree opening angle, body extending in the -z direction.
 
 ConeSDF (const Vec3T< T > &a_tip, const T &a_height, const T &a_angle) noexcept
 Full constructor.
 
 ConeSDF (const ConeSDF &)=default
 Copy constructor.
 
 ConeSDF (ConeSDF &&)=default
 Move constructor.
 
ConeSDFoperator= (const ConeSDF &)=default
 Copy assignment.
 
ConeSDFoperator= (ConeSDF &&)=default
 Move assignment.
 
 ~ConeSDF () override=default
 Destructor.
 
signedDistance (const Vec3T< T > &a_point) const noexcept override
 Signed distance function for the finite cone.
 
- 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_tip = Vec3T<T>::zeros()
 Tip position.
 
Vec2T< T > m_c = Vec2T<T>(std::sin(pi<T> / T(8)), std::cos(pi<T> / T(8)))
 (sin, cos) of the half opening-angle. Default: 45° full angle → half-angle 22.5°.
 
m_height = T(1)
 Cone height (tip to base).
 

Detailed Description

template<class T>
class EBGeometry::ConeSDF< T >

Signed distance field for a finite cone.

The cone tip is at m_tip and the body opens in the -z direction, so the base disc lies at m_tip + (0, 0, -m_height). The full opening angle a_angle is the tip-to-tip apex angle; internally the half-angle is encoded as m_c = (std::sin(half_angle), std::cos(half_angle)). The base radius equals m_height * std::tan(half_angle) = m_height * m_c.x / m_c.y.

The SDF is negative inside the solid cone (including the base disc) and positive outside. By default the tip is at the origin, the height is 1, and the full opening angle is 45°, giving a base radius of std::tan(22.5°) ≈ 0.414.

Template Parameters
TFloating-point precision.

Constructor & Destructor Documentation

◆ ConeSDF()

template<class T >
EBGeometry::ConeSDF< T >::ConeSDF ( const Vec3T< T > &  a_tip,
const T &  a_height,
const T &  a_angle 
)
inlinenoexcept

Full constructor.

Parameters
[in]a_tipCone tip position.
[in]a_heightCone height (tip to base).
[in]a_angleFull opening angle in degrees.

Member Function Documentation

◆ operator=() [1/2]

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

Move assignment.

Returns
Reference to (*this).

◆ operator=() [2/2]

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

Copy assignment.

Returns
Reference to (*this).

◆ signedDistance()

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

Signed distance function for the finite cone.

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

Implements EBGeometry::SignedDistanceFunction< T >.


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