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

Signed distance field for a tube (a pipe): the space between two coaxial cylinders, cut flat at two end centers. More...

#include <EBGeometry_AnalyticDistanceFunctions.hpp>

Public Member Functions

 TubeSDF ()=default
 Default constructor. Constructs a tube from (0,-0.5,0) to (0,0.5,0), with inner radius 0.5 and outer radius 1.
 
 TubeSDF (const Vec3T< T > &a_center1, const Vec3T< T > &a_center2, const T a_innerRadius, const T a_outerRadius)
 Full constructor.
 
 TubeSDF (const TubeSDF &)=default
 Copy constructor.
 
 TubeSDF (TubeSDF &&)=default
 Move constructor.
 
TubeSDF & operator= (const TubeSDF &)=default
 Copy assignment.
 
TubeSDF & operator= (TubeSDF &&)=default
 Move assignment.
 
const Vec3T< T > & getCenter1 () const noexcept
 Get the center of one end.
 
const Vec3T< T > & getCenter2 () const noexcept
 Get the center of the other end.
 
const T & getInnerRadius () const noexcept
 Get the inner radius.
 
const T & getOuterRadius () const noexcept
 Get the outer radius.
 
T signedDistance (const Vec3T< T > &a_point) const noexcept
 Signed distance function for the tube.
 
uint32_t getNumParts () const noexcept
 How many parts the shape has (see hasParts): 4.
 
uint32_t closestPart (const Vec3T< T > &a_point) const noexcept
 The part whose term decides the value at a point (see hasParts): 0 the outer wall, 1 the inner wall, 2 the end at the first center, 3 the end at the second.
 
BoundingVolumes::AABBT< T > computeBoundingVolume () const noexcept
 The shape's axis-aligned bounding box: the box of the outer cylinder.
 

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_center1 = Vec3T<T>(T(0), T(-0.5), T(0))
 Center of one end.
 
Vec3T< T > m_center2 = Vec3T<T>(T(0), T(0.5), T(0))
 Center of the other end.
 
Vec3T< T > m_axis = Vec3T<T>(T(0), T(1), T(0))
 Unit axis from m_center1 to m_center2.
 
T m_length = T(1)
 Distance between the end centers.
 
T m_innerRadius = T(0.5)
 Inner radius.
 
T m_outerRadius = T(1)
 Outer radius.
 

Detailed Description

template<class T>
class EBGeometry::TubeSDF< T >

Signed distance field for a tube (a pipe): the space between two coaxial cylinders, cut flat at two end centers.

The distance is exact: an annulus in the cross-section, extruded between the end planes. An inner radius of 0 would be a cylinder (CylinderSDF). Round its edges with Offset of a slightly smaller tube. By default the tube runs from (0,-0.5,0) to (0,0.5,0), with inner radius 0.5 and outer radius 1.

Template Parameters
TFloating-point precision.

Constructor & Destructor Documentation

◆ TubeSDF()

template<class T >
EBGeometry::TubeSDF< T >::TubeSDF ( const Vec3T< T > &  a_center1,
const Vec3T< T > &  a_center2,
const T  a_innerRadius,
const T  a_outerRadius 
)
inline

Full constructor.

Parameters
[in]a_center1Center of one end.
[in]a_center2Center of the other end; it must differ from a_center1.
[in]a_innerRadiusInner radius, positive.
[in]a_outerRadiusOuter radius, finite and larger than the inner radius.

Member Function Documentation

◆ closestPart()

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

The part whose term decides the value at a point (see hasParts): 0 the outer wall, 1 the inner wall, 2 the end at the first center, 3 the end at the second.

Parameters
[in]a_pointPosition.
Returns
The part.

◆ computeBoundingVolume()

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

The shape's axis-aligned bounding box: the box of the outer cylinder.

Returns
The bounding box.

◆ getCenter1()

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

Get the center of one end.

Returns
m_center1.

◆ getCenter2()

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

Get the center of the other end.

Returns
m_center2.

◆ getInnerRadius()

template<class T >
const T & EBGeometry::TubeSDF< T >::getInnerRadius ( ) const
inlinenoexcept

Get the inner radius.

Returns
m_innerRadius.

◆ getNumParts()

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

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

Returns
The count.

◆ getOuterRadius()

template<class T >
const T & EBGeometry::TubeSDF< T >::getOuterRadius ( ) const
inlinenoexcept

Get the outer radius.

Returns
m_outerRadius.

◆ operator=() [1/2]

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

Copy assignment.

Returns
Reference to (*this).

◆ operator=() [2/2]

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

Move assignment.

Returns
Reference to (*this).

◆ signedDistance()

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

Signed distance function for the tube.

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

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