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

Signed distance function for a rectangle in 2D space. More...

#include <distance.hpp>

Inheritance diagram for vulpes::geometry::dist2d::RectangleDistance< FloatType >:
[legend]
Collaboration diagram for vulpes::geometry::dist2d::RectangleDistance< FloatType >:
[legend]

Public Member Functions

 RectangleDistance (const Point< FloatType, 2 > &corner_a, const Point< FloatType, 2 > &corner_b)
 Constructor for the rectangle distance function.
void operator() (const Point< FloatType, 2 > &point, FloatType *distance_buffer) const
 Compute the signed distance between a point and the rectangle.
std::array< Point< FloatType, 2 >, 2 > bbox () const
 Get the bounding box of the rectangle.
void operator() (const Point< FloatType, Dim > &point, FloatType *distance_buffer) const
 Evaluate the distance function for the given point.

Static Public Member Functions

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

Static Public Attributes

static constexpr bool is_leaf = true
 A flag indicating that this is a leaf node in a composite expression. Indeed we give an explicit formula to compute the distance.

Private Attributes

const Point< FloatType, 2 > m_corner_a
 One corner of the rectangle.
const Point< FloatType, 2 > m_corner_b
 Opposite corner of the rectangle.

Detailed Description

template<typename FloatType>
class vulpes::geometry::dist2d::RectangleDistance< FloatType >

Signed distance function for a rectangle in 2D space.

This class computes the signed distance between a point and a rectangle defined by two corner points.

Template Parameters
FloatTypeThe type of floating-point value.

Constructor & Destructor Documentation

◆ RectangleDistance()

template<typename FloatType>
vulpes::geometry::dist2d::RectangleDistance< FloatType >::RectangleDistance ( const Point< FloatType, 2 > & corner_a,
const Point< FloatType, 2 > & corner_b )
inline

Constructor for the rectangle distance function.

Parameters
corner_alower left corner.
corner_bupper right corner.

Member Function Documentation

◆ bbox()

template<typename FloatType>
std::array< Point< FloatType, 2 >, 2 > vulpes::geometry::dist2d::RectangleDistance< FloatType >::bbox ( ) const
inline

Get the bounding box of the rectangle.

Returns
The bounding box as an array of two points.

◆ operator()() [1/2]

template<typename FloatType>
void vulpes::geometry::dist2d::RectangleDistance< FloatType >::operator() ( const Point< FloatType, 2 > & point,
FloatType * distance_buffer ) const
inline

Compute the signed distance between a point and the rectangle.

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

◆ operator()() [2/2]

void vulpes::geometry::DistanceExpression< FloatType, Dim, RectangleDistance< FloatType > >::operator() ( const Point< FloatType, Dim > & point,
FloatType * distance_buffer ) const
inlineinherited

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>
constexpr size_t vulpes::geometry::dist2d::RectangleDistance< FloatType >::size ( )
inlinestaticconstexpr

Get the size of the distance buffer for this distance function.

Returns
The size of the buffer (4 for the sides + 1 for self).

Member Data Documentation

◆ is_leaf

template<typename FloatType>
bool vulpes::geometry::dist2d::RectangleDistance< FloatType >::is_leaf = true
staticconstexpr

A flag indicating that this is a leaf node in a composite expression. Indeed we give an explicit formula to compute the distance.

◆ m_corner_a

template<typename FloatType>
const Point<FloatType, 2> vulpes::geometry::dist2d::RectangleDistance< FloatType >::m_corner_a
private

One corner of the rectangle.

◆ m_corner_b

template<typename FloatType>
const Point<FloatType, 2> vulpes::geometry::dist2d::RectangleDistance< FloatType >::m_corner_b
private

Opposite corner of the rectangle.


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