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

Signed distance field for an axis-aligned box (AABB). More...

#include <EBGeometry_AnalyticDistanceFunctions.hpp>

Inheritance diagram for EBGeometry::BoxSDF< T >:
Inheritance graph
[legend]
Collaboration diagram for EBGeometry::BoxSDF< T >:
Collaboration graph
[legend]

Public Member Functions

 BoxSDF ()=default
 Default constructor. Constructs a unit cube centered at the origin: [-0.5, 0.5]^3.
 
 BoxSDF (const Vec3T< T > &a_loCorner, const Vec3T< T > &a_hiCorner) noexcept
 Full constructor.
 
 BoxSDF (const BoxSDF &)=default
 Copy constructor.
 
 BoxSDF (BoxSDF &&)=default
 Move constructor.
 
BoxSDFoperator= (const BoxSDF &)=default
 Copy assignment.
 
BoxSDFoperator= (BoxSDF &&)=default
 Move assignment.
 
 ~BoxSDF () override=default
 Destructor.
 
const Vec3T< T > & getLowCorner () const noexcept
 Get lower-left corner.
 
Vec3T< T > & getLowCorner () noexcept
 Get lower-left corner.
 
const Vec3T< T > & getHighCorner () const noexcept
 Get upper-right corner.
 
Vec3T< T > & getHighCorner () noexcept
 Get upper-right corner.
 
signedDistance (const Vec3T< T > &a_point) const noexcept override
 Signed distance function for the axis-aligned box.
 
- Public Member Functions inherited from EBGeometry::SignedDistanceFunction< T >
 SignedDistanceFunction ()=default
 Default constructor.
 
 ~SignedDistanceFunction () override=default
 Destructor.
 
value (const Vec3T< T > &a_point) const noexcept final
 Implementation of ImplicitFunction::value; delegates to signedDistance().
 
virtual Vec3T< T > normal (const Vec3T< T > &a_point, const T &a_delta) const noexcept
 Compute the outward normal using central finite differences.
 
- Public Member Functions inherited from EBGeometry::ImplicitFunction< T >
 ImplicitFunction ()=default
 Default constructor.
 
virtual ~ImplicitFunction ()=default
 Default destructor.
 
operator() (const Vec3T< T > &a_point) const noexcept
 Call operator — alternative signature for the value function.
 
template<class BV >
BV approximateBoundingVolumeOctree (const Vec3T< T > &a_initialLowCorner, const Vec3T< T > &a_initialHighCorner, const unsigned int a_maxTreeDepth, const T &a_safety=0.0) const
 Compute an approximation to the bounding volume for the implicit surface using octree subdivision.
 

Protected Attributes

Vec3T< T > m_loCorner = Vec3T<T>(T(-0.5), T(-0.5), T(-0.5))
 Low box corner.
 
Vec3T< T > m_hiCorner = Vec3T<T>(T(0.5), T(0.5), T(0.5))
 High box corner.
 

Detailed Description

template<class T>
class EBGeometry::BoxSDF< T >

Signed distance field for an axis-aligned box (AABB).

The box is defined by its lower and upper corners m_loCorner and m_hiCorner. It is axis-aligned (faces are perpendicular to the coordinate axes). The SDF is negative inside and positive outside. Side lengths are m_hiCorner[i] - m_loCorner[i] per axis. By default the box is the unit cube [-0.5, 0.5]^3 centered at the origin.

Template Parameters
TFloating-point precision.

Constructor & Destructor Documentation

◆ BoxSDF()

template<class T >
EBGeometry::BoxSDF< T >::BoxSDF ( const Vec3T< T > &  a_loCorner,
const Vec3T< T > &  a_hiCorner 
)
inlinenoexcept

Full constructor.

Parameters
[in]a_loCornerLower corner (minimum x, y, z).
[in]a_hiCornerUpper corner (maximum x, y, z). Each component must be strictly greater than the corresponding component of a_loCorner.

Member Function Documentation

◆ getHighCorner() [1/2]

template<class T >
const Vec3T< T > & EBGeometry::BoxSDF< T >::getHighCorner ( ) const
inlinenoexcept

Get upper-right corner.

Returns
m_hiCorner

◆ getHighCorner() [2/2]

template<class T >
Vec3T< T > & EBGeometry::BoxSDF< T >::getHighCorner ( )
inlinenoexcept

Get upper-right corner.

Returns
m_hiCorner

◆ getLowCorner() [1/2]

template<class T >
const Vec3T< T > & EBGeometry::BoxSDF< T >::getLowCorner ( ) const
inlinenoexcept

Get lower-left corner.

Returns
m_loCorner

◆ getLowCorner() [2/2]

template<class T >
Vec3T< T > & EBGeometry::BoxSDF< T >::getLowCorner ( )
inlinenoexcept

Get lower-left corner.

Returns
m_loCorner

◆ operator=() [1/2]

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

Move assignment.

Returns
Reference to (*this).

◆ operator=() [2/2]

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

Copy assignment.

Returns
Reference to (*this).

◆ signedDistance()

template<class T >
T EBGeometry::BoxSDF< T >::signedDistance ( const Vec3T< T > &  a_point) const
inlineoverridevirtualnoexcept

Signed distance function for the axis-aligned box.

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

Implements EBGeometry::SignedDistanceFunction< T >.


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