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

Signed distance field for an axis-aligned box with rounded corners. More...

#include <EBGeometry_AnalyticDistanceFunctions.hpp>

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

Public Member Functions

 RoundedBoxSDF ()=default
 Default constructor. Constructs a rounded unit cube centered at the origin ([-0.5, 0.5]^3 before rounding) with corner curvature 0.1.
 
 RoundedBoxSDF (const Vec3T< T > &a_dimensions, const T a_curvature) noexcept
 Full constructor.
 
 RoundedBoxSDF (const RoundedBoxSDF &)=default
 Copy constructor. Shares the internal sphere object.
 
 RoundedBoxSDF (RoundedBoxSDF &&)=default
 Move constructor.
 
RoundedBoxSDFoperator= (const RoundedBoxSDF &)=default
 Copy assignment. Shares the internal sphere object.
 
RoundedBoxSDFoperator= (RoundedBoxSDF &&)=default
 Move assignment.
 
 ~RoundedBoxSDF () override=default
 Destructor.
 
signedDistance (const Vec3T< T > &a_point) const noexcept override
 Signed distance function for the rounded 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

std::shared_ptr< SphereSDF< T > > m_sphere = std::make_shared<SphereSDF<T>>(Vec3T<T>::zeros(), T(0.1))
 Sphere of radius = curvature used to round the corners.
 
Vec3T< T > m_dimensions = Vec3T<T>(T(0.5), T(0.5), T(0.5))
 Half-extents of the inner box (= 0.5 * the user-supplied dimensions).
 

Detailed Description

template<class T>
class EBGeometry::RoundedBoxSDF< T >

Signed distance field for an axis-aligned box with rounded corners.

The box is centred at the origin. The constructor takes the full side lengths along each axis and a corner curvature radius. Internally, half-extents m_dimensions = 0.5 * a_dimensions are stored. The actual bounding half-extent in each direction is m_dimensions[i] + curvature, so the total bounding box has full side lengths a_dimensions[i] + 2 * curvature. The corners are rounded by spheres of radius curvature. The SDF is negative inside and positive outside.

Template Parameters
TFloating-point precision.

Constructor & Destructor Documentation

◆ RoundedBoxSDF() [1/2]

template<class T >
EBGeometry::RoundedBoxSDF< T >::RoundedBoxSDF ( )
default

Default constructor. Constructs a rounded unit cube centered at the origin ([-0.5, 0.5]^3 before rounding) with corner curvature 0.1.

Total half-extent in each direction is 0.5 + 0.1 = 0.6.

◆ RoundedBoxSDF() [2/2]

template<class T >
EBGeometry::RoundedBoxSDF< T >::RoundedBoxSDF ( const Vec3T< T > &  a_dimensions,
const a_curvature 
)
inlinenoexcept

Full constructor.

The total half-extent in direction i is 0.5*a_dimensions[i] + a_curvature.

Parameters
[in]a_dimensionsBox dimensions (full side lengths before rounding).
[in]a_curvatureCorner sphere radius. Must be > 0.

Member Function Documentation

◆ operator=() [1/2]

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

Copy assignment. Shares the internal sphere object.

Returns
Reference to (*this).

◆ operator=() [2/2]

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

Move assignment.

Returns
Reference to (*this).

◆ signedDistance()

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

Signed distance function for the rounded box.

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

Implements EBGeometry::SignedDistanceFunction< T >.


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