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

Template class representing a generic signed distance expression. More...

#include <distance.hpp>

Public Member Functions

void operator() (const Point< FloatType, Dim > &point, FloatType *distance_buffer) const
 Evaluate the distance function for the given point.
std::array< Point< FloatType, Dim >, 2 > bbox () const
 Get the bounding box (bbox) of the shape.

Static Public Member Functions

static constexpr size_t size ()
 Get the size of the distance buffer required for this expression.

Static Public Attributes

static constexpr bool is_leaf = false
 A flag indicating whether this is a leaf node in a composite expression.

Detailed Description

template<typename FloatType, int32_t Dim, typename Distance>
class vulpes::geometry::DistanceExpression< FloatType, Dim, Distance >

Template class representing a generic signed distance expression.

This template class defines the interface for various distance functions via CRTP. It provides static methods and operators to calculate the distance between a given point and a shape, and to compute the bounding box (bbox) of that shape. The distance expression keeps in "memory" the distances with each shape it is composed of (e.g. in the intersection of a rectangle and a circle the output distance gives the distance with respect to each segment of the rectangle and the circle)

Template Parameters
FloatTypeThe type of floating-point value (e.g., float, double).
DimThe dimensionality of the space (e.g., 2D or 3D).
DistanceThe specific distance function that will be used (e.g., RectangleDistance, CircleDistance).

Member Function Documentation

◆ bbox()

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

Get the bounding box (bbox) of the shape.

This function delegates to the bbox() method of the Distance type.

Returns
The bounding box as an array of two points (lower and upper corners).

◆ operator()()

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

Evaluate the distance function for the given point.

This function computes the signed distance between a point and the shape defined by the Distance type. The result is stored in the provided distance_buffer.

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

◆ size()

template<typename FloatType, int32_t Dim, typename Distance>
constexpr size_t vulpes::geometry::DistanceExpression< FloatType, Dim, Distance >::size ( )
inlinestaticconstexpr

Get the size of the distance buffer required for this expression.

This method delegates to the size() method of the Distance type. E.g. a rectangle will need a buffer of 4 to save the distance with respect to each side, plus one that is the distance with respect itself.

Returns
The size of the distance buffer.

Member Data Documentation

◆ is_leaf

template<typename FloatType, int32_t Dim, typename Distance>
bool vulpes::geometry::DistanceExpression< FloatType, Dim, Distance >::is_leaf = false
staticconstexpr

A flag indicating whether this is a leaf node in a composite expression.


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