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

Signed distance field for a sphere. More...

#include <EBGeometry_AnalyticDistanceFunctions.hpp>

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

Public Member Functions

 SphereSDF ()=default
 Default constructor. Constructs a unit sphere centered at the origin.
 
 SphereSDF (const Vec3T< T > &a_center, const T &a_radius) noexcept
 Full constructor.
 
 SphereSDF (const SphereSDF &)=default
 Copy constructor.
 
 SphereSDF (SphereSDF &&)=default
 Move constructor.
 
SphereSDFoperator= (const SphereSDF &)=default
 Copy assignment.
 
SphereSDFoperator= (SphereSDF &&)=default
 Move assignment.
 
 ~SphereSDF () override=default
 Destructor.
 
const Vec3T< T > & getCenter () const noexcept
 Get sphere center (const).
 
Vec3T< T > & getCenter () noexcept
 Get sphere center (mutable).
 
const T & getRadius () const noexcept
 Get sphere radius (const).
 
T & getRadius () noexcept
 Get sphere radius (mutable).
 
signedDistance (const Vec3T< T > &a_point) const noexcept override
 Signed distance function for the sphere.
 
- 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_center = Vec3T<T>::zeros()
 Sphere center.
 
m_radius = T(1)
 Sphere radius.
 

Detailed Description

template<class T>
class EBGeometry::SphereSDF< T >

Signed distance field for a sphere.

The sphere is placed at m_center with radius m_radius. The SDF is negative inside the sphere and positive outside. By default the sphere is centered at the origin with radius 1.

Template Parameters
TFloating-point precision.

Constructor & Destructor Documentation

◆ SphereSDF()

template<class T >
EBGeometry::SphereSDF< T >::SphereSDF ( const Vec3T< T > &  a_center,
const T &  a_radius 
)
inlinenoexcept

Full constructor.

Parameters
[in]a_centerSphere center.
[in]a_radiusSphere radius.

Member Function Documentation

◆ getCenter() [1/2]

template<class T >
const Vec3T< T > & EBGeometry::SphereSDF< T >::getCenter ( ) const
inlinenoexcept

Get sphere center (const).

Returns
Const reference to the center position.

◆ getCenter() [2/2]

template<class T >
Vec3T< T > & EBGeometry::SphereSDF< T >::getCenter ( )
inlinenoexcept

Get sphere center (mutable).

Returns
Mutable reference to the center position.

◆ getRadius() [1/2]

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

Get sphere radius (const).

Returns
Const reference to the radius.

◆ getRadius() [2/2]

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

Get sphere radius (mutable).

Returns
Mutable reference to the radius.

◆ operator=() [1/2]

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

Copy assignment.

Returns
Reference to (*this).

◆ operator=() [2/2]

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

Move assignment.

Returns
Reference to (*this).

◆ signedDistance()

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

Signed distance function for the sphere.

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

Implements EBGeometry::SignedDistanceFunction< T >.


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