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

Signed distance function for a plane. More...

#include <EBGeometry_AnalyticDistanceFunctions.hpp>

Public Member Functions

 PlaneSDF ()=default
 Default constructor. Constructs the y = 0 plane with outward normal (0, 1, 0).
 
 PlaneSDF (const Vec3T< T > &a_point, const Vec3T< T > &a_normal) noexcept
 Full constructor.
 
 PlaneSDF (const PlaneSDF &)=default
 Copy constructor.
 
 PlaneSDF (PlaneSDF &&)=default
 Move constructor.
 
PlaneSDF & operator= (const PlaneSDF &)=default
 Copy assignment.
 
PlaneSDF & operator= (PlaneSDF &&)=default
 Move assignment.
 
T signedDistance (const Vec3T< T > &a_point) const noexcept
 Signed distance function for the plane.
 
BoundingVolumes::AABBT< T > computeBoundingVolume () const noexcept
 The shape's axis-aligned bounding box.
 
const Vec3T< T > & getPoint () const noexcept
 Get the point on the plane.
 
const Vec3T< T > & getNormal () const noexcept
 Get the unit normal of the plane.
 

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_point = Vec3T<T>::zeros()
 Point on plane.
 
Vec3T< T > m_normal = Vec3T<T>(T(0), T(1), T(0))
 Plane normal vector (unit length).
 

Detailed Description

template<class T>
class EBGeometry::PlaneSDF< T >

Signed distance function for a plane.

The SDF evaluates to dot(a_point - m_point, m_normal): positive on the half-space the normal points into, negative on the opposite side. The plane itself is the zero level-set. m_normal must be unit length for the SDF to return a true distance; the full constructor normalizes the input automatically. By default the plane is the y = 0 plane with normal (0,1,0).

Template Parameters
TFloating-point precision.

Constructor & Destructor Documentation

◆ PlaneSDF() [1/2]

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

Default constructor. Constructs the y = 0 plane with outward normal (0, 1, 0).

The default plane passes through the origin and separates y < 0 (negative SDF) from y > 0 (positive SDF).

◆ PlaneSDF() [2/2]

template<class T >
EBGeometry::PlaneSDF< T >::PlaneSDF ( const Vec3T< T > &  a_point,
const Vec3T< T > &  a_normal 
)
inlinenoexcept

Full constructor.

Parameters
[in]a_pointAny point on the plane.
[in]a_normalPlane normal vector (need not be unit length; it is normalized internally).

Member Function Documentation

◆ computeBoundingVolume()

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

The shape's axis-aligned bounding box.

A plane is unbounded in every direction a box can describe, so the box is the whole space.

Returns
The bounding box.

◆ getNormal()

template<class T >
const Vec3T< T > & EBGeometry::PlaneSDF< T >::getNormal ( ) const
inlinenoexcept

Get the unit normal of the plane.

Returns
The unit normal of the plane.

◆ getPoint()

template<class T >
const Vec3T< T > & EBGeometry::PlaneSDF< T >::getPoint ( ) const
inlinenoexcept

Get the point on the plane.

Returns
The point on the plane.

◆ operator=() [1/2]

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

Copy assignment.

Returns
Reference to (*this).

◆ operator=() [2/2]

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

Move assignment.

Returns
Reference to (*this).

◆ signedDistance()

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

Signed distance function for the plane.

Parameters
[in]a_pointPosition.
Returns
Signed distance from a_point to the plane; negative on the side opposite to the normal.

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