Vulpes  0.1.0
Versatile and parallel compUtational Library for high-order discontinuous Polytopal Element Simulations
Loading...
Searching...
No Matches
vulpes::geometry::UnionDistance< FloatType, Dim, D1, D2 > Class Template Reference

Represents the union of two signed distance functions. More...

#include <distance.hpp>

Inheritance diagram for vulpes::geometry::UnionDistance< FloatType, Dim, D1, D2 >:
[legend]
Collaboration diagram for vulpes::geometry::UnionDistance< FloatType, Dim, D1, D2 >:
[legend]

Public Member Functions

 UnionDistance (D1 const &u, D2 const &v)
 Constructor for the union distance function.
void operator() (const Point< FloatType, Dim > &point, FloatType *distance_buffer) const
 Compute the signed distance between a point and the union of two shapes.
std::array< Point< FloatType, Dim >, 2 > bbox () const
 Get the bounding box of the union of two shapes.

Static Public Member Functions

static constexpr size_t size ()
 Get the size of the distance buffer for this union operation.

Static Public Attributes

static constexpr bool is_leaf = false

Private Attributes

std::conditional_t< D1::is_leaf, const D1 &, const D1 > m_u
std::conditional_t< D2::is_leaf, const D2 &, const D2 > m_v

Detailed Description

template<typename FloatType, int32_t Dim, typename D1, typename D2>
class vulpes::geometry::UnionDistance< FloatType, Dim, D1, D2 >

Represents the union of two signed distance functions.

This class computes the signed distance between a point and the union of two shapes, where the distance to the union is defined as the minimum of the distances to the individual shapes.

Template Parameters
FloatTypeThe type of floating-point value.
DimThe dimensionality of the space (e.g., 2D or 3D).
D1The first distance function (e.g., RectangleDistance, CircleDistance).
D2The second distance function.

Constructor & Destructor Documentation

◆ UnionDistance()

template<typename FloatType, int32_t Dim, typename D1, typename D2>
vulpes::geometry::UnionDistance< FloatType, Dim, D1, D2 >::UnionDistance ( D1 const & u,
D2 const & v )
inline

Constructor for the union distance function.

Parameters
uThe first distance function.
vThe second distance function.

Member Function Documentation

◆ bbox()

template<typename FloatType, int32_t Dim, typename D1, typename D2>
std::array< Point< FloatType, Dim >, 2 > vulpes::geometry::UnionDistance< FloatType, Dim, D1, D2 >::bbox ( ) const
inline

Get the bounding box of the union of two shapes.

The bounding box of the union is the box that encompasses both shapes.

Returns
The bounding box as an array of two points.

◆ operator()()

template<typename FloatType, int32_t Dim, typename D1, typename D2>
void vulpes::geometry::UnionDistance< FloatType, Dim, D1, D2 >::operator() ( const Point< FloatType, Dim > & point,
FloatType * distance_buffer ) const
inline

Compute the signed distance between a point and the union of two shapes.

The distance is the minimum of the distances to the two shapes.

Parameters
pointThe point for which the distance is to be computed.
distance_bufferThe buffer where the computed distances will be stored.

◆ size()

template<typename FloatType, int32_t Dim, typename D1, typename D2>
constexpr size_t vulpes::geometry::UnionDistance< FloatType, Dim, D1, D2 >::size ( )
inlinestaticconstexpr

Get the size of the distance buffer for this union operation.

The size is the sum of the sizes of the individual distance buffers for D1 and D2.

Returns
The size of the distance buffer.

Member Data Documentation

◆ is_leaf

template<typename FloatType, int32_t Dim, typename D1, typename D2>
bool vulpes::geometry::UnionDistance< FloatType, Dim, D1, D2 >::is_leaf = false
staticconstexpr

◆ m_u

template<typename FloatType, int32_t Dim, typename D1, typename D2>
std::conditional_t<D1::is_leaf, const D1&, const D1> vulpes::geometry::UnionDistance< FloatType, Dim, D1, D2 >::m_u
private

The first distance function. If it is concrete we just need a reference, otherwise we copy the expression.

◆ m_v

template<typename FloatType, int32_t Dim, typename D1, typename D2>
std::conditional_t<D2::is_leaf, const D2&, const D2> vulpes::geometry::UnionDistance< FloatType, Dim, D1, D2 >::m_v
private

The second distance function. If it is concrete we just need a reference, otherwise we copy the expression.


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