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

Signed distance field for a cut hollow sphere: a spherical shell of some thickness, the part above a horizontal plane, such as a dome or a radome. More...

#include <EBGeometry_AnalyticDistanceFunctions.hpp>

Public Member Functions

 CutHollowSphereSDF ()=default
 Default constructor. Constructs the upper half of a shell of thickness 0.1 around the unit sphere at the origin.
 
 CutHollowSphereSDF (const Vec3T< T > &a_center, const T a_radius, const T a_height, const T a_thickness)
 Full constructor.
 
 CutHollowSphereSDF (const CutHollowSphereSDF &)=default
 Copy constructor.
 
 CutHollowSphereSDF (CutHollowSphereSDF &&)=default
 Move constructor.
 
CutHollowSphereSDF & operator= (const CutHollowSphereSDF &)=default
 Copy assignment.
 
CutHollowSphereSDF & operator= (CutHollowSphereSDF &&)=default
 Move assignment.
 
const Vec3T< T > & getCenter () const noexcept
 Get the center of the sphere.
 
const T & getRadius () const noexcept
 Get the radius of the shell's middle surface.
 
const T & getHeight () const noexcept
 Get the height of the cut plane above the center.
 
const T & getThickness () const noexcept
 Get the shell's thickness.
 
T signedDistance (const Vec3T< T > &a_point) const noexcept
 Signed distance function for the cut hollow sphere.
 
uint32_t getNumParts () const noexcept
 How many parts the shape has (see hasParts): 2.
 
uint32_t closestPart (const Vec3T< T > &a_point) const noexcept
 The part whose term decides the value at a point (see hasParts): 0 the shell, 1 its rounded rim.
 
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()
 Center of the sphere.
 
T m_radius = T(1)
 Radius of the shell's middle surface.
 
T m_height = T(0)
 Height of the cut plane above the center.
 
T m_thickness = T(0.1)
 The shell's thickness.
 
T m_rim = T(1)
 Radius of the rim, sqrt(radius^2 - height^2).
 

Detailed Description

template<class T>
class EBGeometry::CutHollowSphereSDF< T >

Signed distance field for a cut hollow sphere: a spherical shell of some thickness, the part above a horizontal plane, such as a dome or a radome.

The shell is the set of points within half the thickness of the sphere, and the part kept is the one above the cone from the center through the rim, where the sphere meets the plane y = center.y + height. The shell's rims are therefore rounded, with radius half the thickness. The distance is exact (Quilez's cut hollow sphere): the distance to the sphere's arc above the rim, or to the rim, less half the thickness. Turn it with Rotate. By default it is the upper half of a shell of thickness 0.1 around the unit sphere at the origin.

Template Parameters
TFloating-point precision.

Constructor & Destructor Documentation

◆ CutHollowSphereSDF()

template<class T >
EBGeometry::CutHollowSphereSDF< T >::CutHollowSphereSDF ( const Vec3T< T > &  a_center,
const T  a_radius,
const T  a_height,
const T  a_thickness 
)
inline

Full constructor.

Parameters
[in]a_centerCenter of the sphere.
[in]a_radiusRadius of the shell's middle surface, finite and positive.
[in]a_heightHeight of the cut plane above the center, between -a_radius and a_radius.
[in]a_thicknessThe shell's thickness, positive and less than twice the radius.

Member Function Documentation

◆ closestPart()

template<class T >
uint32_t EBGeometry::CutHollowSphereSDF< T >::closestPart ( const Vec3T< T > &  a_point) const
inlinenoexcept

The part whose term decides the value at a point (see hasParts): 0 the shell, 1 its rounded rim.

Parameters
[in]a_pointPosition.
Returns
The part.

◆ computeBoundingVolume()

template<class T >
BoundingVolumes::AABBT< T > EBGeometry::CutHollowSphereSDF< T >::computeBoundingVolume ( ) const
inlinenoexcept

The shape's axis-aligned bounding box.

Returns
The bounding box.

◆ getCenter()

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

Get the center of the sphere.

Returns
m_center.

◆ getHeight()

template<class T >
const T & EBGeometry::CutHollowSphereSDF< T >::getHeight ( ) const
inlinenoexcept

Get the height of the cut plane above the center.

Returns
m_height.

◆ getNumParts()

template<class T >
uint32_t EBGeometry::CutHollowSphereSDF< T >::getNumParts ( ) const
inlinenoexcept

How many parts the shape has (see hasParts): 2.

Returns
The count.

◆ getRadius()

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

Get the radius of the shell's middle surface.

Returns
m_radius.

◆ getThickness()

template<class T >
const T & EBGeometry::CutHollowSphereSDF< T >::getThickness ( ) const
inlinenoexcept

Get the shell's thickness.

Returns
m_thickness.

◆ operator=() [1/2]

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

Copy assignment.

Returns
Reference to (*this).

◆ operator=() [2/2]

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

Move assignment.

Returns
Reference to (*this).

◆ signedDistance()

template<class T >
T EBGeometry::CutHollowSphereSDF< T >::signedDistance ( const Vec3T< T > &  a_point) const
inlinenoexcept

Signed distance function for the cut hollow sphere.

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

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