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

Signed distance field for an infinitely long cylinder. More...

#include <EBGeometry_AnalyticDistanceFunctions.hpp>

Public Member Functions

 InfiniteCylinderSDF ()=default
 Default constructor. Constructs an infinite cylinder of radius 1 centered at the origin with its axis along y (axis index 1).
 
 InfiniteCylinderSDF (const Vec3T< T > &a_center, const T &a_radius, const size_t a_axis) noexcept
 Full constructor.
 
 InfiniteCylinderSDF (const InfiniteCylinderSDF &)=default
 Copy constructor.
 
 InfiniteCylinderSDF (InfiniteCylinderSDF &&)=default
 Move constructor.
 
InfiniteCylinderSDF & operator= (const InfiniteCylinderSDF &)=default
 Copy assignment.
 
InfiniteCylinderSDF & operator= (InfiniteCylinderSDF &&)=default
 Move assignment.
 
T signedDistance (const Vec3T< T > &a_point) const noexcept
 Signed distance function for the infinite cylinder.
 
BoundingVolumes::AABBT< T > computeBoundingVolume () const noexcept
 The shape's axis-aligned bounding box.
 
const Vec3T< T > & getCenter () const noexcept
 Get the point on the axis.
 
const T & getRadius () const noexcept
 Get the radius.
 
const size_t & getAxis () const noexcept
 Get the coordinate axis the cylinder runs along.
 

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 point on the cylinder axis.
 
T m_radius = T(1)
 Cylinder radius.
 
size_t m_axis = 1U
 Coordinate axis index (0 = x, 1 = y, 2 = z).
 

Detailed Description

template<class T>
class EBGeometry::InfiniteCylinderSDF< T >

Signed distance field for an infinitely long cylinder.

The cylinder is infinite in one coordinate direction (selected by m_axis: 0 = x, 1 = y, 2 = z) and has a circular cross-section of radius m_radius centered at m_center in the plane perpendicular to that axis. The SDF is the radial distance from the axis minus the radius: negative inside the cylinder and positive outside. By default the cylinder has radius 1, passes through the origin, and extends along y.

Template Parameters
TFloating-point precision.

Constructor & Destructor Documentation

◆ InfiniteCylinderSDF()

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

Full constructor.

Parameters
[in]a_centerCenter point on the cylinder axis.
[in]a_radiusCylinder radius.
[in]a_axisCoordinate axis index (0 = x, 1 = y, 2 = z).

Member Function Documentation

◆ computeBoundingVolume()

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

The shape's axis-aligned bounding box.

The center plus and minus the radius across the axis, and unbounded along it.

Returns
The bounding box.

◆ getAxis()

template<class T >
const size_t & EBGeometry::InfiniteCylinderSDF< T >::getAxis ( ) const
inlinenoexcept

Get the coordinate axis the cylinder runs along.

Returns
The coordinate axis the cylinder runs along.

◆ getCenter()

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

Get the point on the axis.

Returns
The point on the axis.

◆ getRadius()

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

Get the radius.

Returns
The radius.

◆ operator=() [1/2]

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

Copy assignment.

Returns
Reference to (*this).

◆ operator=() [2/2]

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

Move assignment.

Returns
Reference to (*this).

◆ signedDistance()

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

Signed distance function for the infinite cylinder.

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

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