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

Signed distance field for an infinite wedge: a knife edge. More...

#include <EBGeometry_AnalyticDistanceFunctions.hpp>

Public Member Functions

 WedgeSDF ()=default
 Default constructor. Constructs a wedge with its tip at the origin and an opening of 60 degrees.
 
 WedgeSDF (const Vec3T< T > &a_tip, const T a_angle)
 Full constructor.
 
 WedgeSDF (const WedgeSDF &)=default
 Copy constructor.
 
 WedgeSDF (WedgeSDF &&)=default
 Move constructor.
 
WedgeSDF & operator= (const WedgeSDF &)=default
 Copy assignment.
 
WedgeSDF & operator= (WedgeSDF &&)=default
 Move assignment.
 
const Vec3T< T > & getTip () const noexcept
 Get the tip, a point on the edge.
 
const T & getAngle () const noexcept
 Get the opening angle, in degrees.
 
Vec3T< T > getFaceNormal () const noexcept
 The unit outward normal of the face on the +x side; the other face's is mirrored in x.
 
T signedDistance (const Vec3T< T > &a_point) const noexcept
 Signed distance function for the wedge.
 
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 face on the -x side of the tip, 1 the one on the +x side; the tip edge goes to the side the point is on.
 
BoundingVolumes::AABBT< T > computeBoundingVolume () const noexcept
 The shape's axis-aligned bounding box: unbounded but above the tip.
 

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_tip = Vec3T<T>::zeros()
 A point on the edge.
 
T m_angle = T(60)
 The opening angle, in degrees.
 
T m_sin = T(0.5)
 Sine of half the opening angle.
 
T m_cos = T(0.86602540378443865)
 Cosine of half the opening angle.
 

Detailed Description

template<class T>
class EBGeometry::WedgeSDF< T >

Signed distance field for an infinite wedge: a knife edge.

The wedge's edge runs along z through the tip, and the wedge points toward +y: it is the space below two planes through the edge, each at half the opening angle from -y. It is unbounded along z, and downward and sideways from the edge. The distance is exact: inside, that to the nearer plane; outside, to the nearer face, or to the edge where the point is beyond both faces. Round the edge with Offset of a wedge whose tip is set back. Turn it with Rotate. By default the tip is at the origin and the opening is 60 degrees.

Template Parameters
TFloating-point precision.

Constructor & Destructor Documentation

◆ WedgeSDF()

template<class T >
EBGeometry::WedgeSDF< T >::WedgeSDF ( const Vec3T< T > &  a_tip,
const T  a_angle 
)
inline

Full constructor.

Parameters
[in]a_tipA point on the edge.
[in]a_angleThe opening angle, in degrees, in (0, 180).

Member Function Documentation

◆ closestPart()

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

The part whose term decides the value at a point (see hasParts): 0 the face on the -x side of the tip, 1 the one on the +x side; the tip edge goes to the side the point is on.

Parameters
[in]a_pointPosition.
Returns
The part.

◆ computeBoundingVolume()

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

The shape's axis-aligned bounding box: unbounded but above the tip.

Returns
The bounding box.

◆ getAngle()

template<class T >
const T & EBGeometry::WedgeSDF< T >::getAngle ( ) const
inlinenoexcept

Get the opening angle, in degrees.

Returns
m_angle.

◆ getFaceNormal()

template<class T >
Vec3T< T > EBGeometry::WedgeSDF< T >::getFaceNormal ( ) const
inlinenoexcept

The unit outward normal of the face on the +x side; the other face's is mirrored in x.

Returns
(cos, sin) of half the opening angle, in x and y.

◆ getNumParts()

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

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

Returns
The count.

◆ getTip()

template<class T >
const Vec3T< T > & EBGeometry::WedgeSDF< T >::getTip ( ) const
inlinenoexcept

Get the tip, a point on the edge.

Returns
m_tip.

◆ operator=() [1/2]

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

Copy assignment.

Returns
Reference to (*this).

◆ operator=() [2/2]

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

Move assignment.

Returns
Reference to (*this).

◆ signedDistance()

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

Signed distance function for the wedge.

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: