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

Signed distance field for a revolved vesica: a lens between two tips, the vesica (the overlap of two discs) in a plane through the tips, turned around the line through them. More...

#include <EBGeometry_AnalyticDistanceFunctions.hpp>

Public Member Functions

 VesicaSDF ()=default
 Default constructor. Constructs a vesica from (0,-1,0) to (0,1,0), with radius 0.5.
 
 VesicaSDF (const Vec3T< T > &a_tip1, const Vec3T< T > &a_tip2, const T a_radius)
 Full constructor.
 
 VesicaSDF (const VesicaSDF &)=default
 Copy constructor.
 
 VesicaSDF (VesicaSDF &&)=default
 Move constructor.
 
VesicaSDF & operator= (const VesicaSDF &)=default
 Copy assignment.
 
VesicaSDF & operator= (VesicaSDF &&)=default
 Move assignment.
 
const Vec3T< T > & getTip1 () const noexcept
 Get one tip.
 
const Vec3T< T > & getTip2 () const noexcept
 Get the other tip.
 
const T & getRadius () const noexcept
 Get the radius at the middle.
 
T signedDistance (const Vec3T< T > &a_point) const noexcept
 Signed distance function for the vesica.
 
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_tip1 = Vec3T<T>(T(0), T(-1), T(0))
 One tip.
 
Vec3T< T > m_tip2 = Vec3T<T>(T(0), T(1), T(0))
 The other tip.
 
T m_radius = T(0.5)
 Radius at the middle.
 

Detailed Description

template<class T>
class EBGeometry::VesicaSDF< T >

Signed distance field for a revolved vesica: a lens between two tips, the vesica (the overlap of two discs) in a plane through the tips, turned around the line through them.

In the cross-section through the axis, the lens' outline is an arc of a circle centered across the axis from it, through both tips; the given radius is the lens' radius at its middle. The distance is exact (Quilez's vesica): to the arc, or to the nearer tip. By default the vesica runs from (0,-1,0) to (0,1,0), with radius 0.5.

Template Parameters
TFloating-point precision.

Constructor & Destructor Documentation

◆ VesicaSDF()

template<class T >
EBGeometry::VesicaSDF< T >::VesicaSDF ( const Vec3T< T > &  a_tip1,
const Vec3T< T > &  a_tip2,
const T  a_radius 
)
inline

Full constructor.

Parameters
[in]a_tip1One tip.
[in]a_tip2The other tip; it must differ from a_tip1.
[in]a_radiusThe lens' radius at its middle, finite, positive and less than half the distance between the tips (a radius of half that distance would make a ball).

Member Function Documentation

◆ computeBoundingVolume()

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

The shape's axis-aligned bounding box.

Returns
The bounding box.

◆ getRadius()

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

Get the radius at the middle.

Returns
m_radius.

◆ getTip1()

template<class T >
const Vec3T< T > & EBGeometry::VesicaSDF< T >::getTip1 ( ) const
inlinenoexcept

Get one tip.

Returns
m_tip1.

◆ getTip2()

template<class T >
const Vec3T< T > & EBGeometry::VesicaSDF< T >::getTip2 ( ) const
inlinenoexcept

Get the other tip.

Returns
m_tip2.

◆ operator=() [1/2]

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

Copy assignment.

Returns
Reference to (*this).

◆ operator=() [2/2]

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

Move assignment.

Returns
Reference to (*this).

◆ signedDistance()

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

Signed distance function for the vesica.

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

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