EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
EBGeometry_SignedDistanceFunction.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2022 Robert Marskar <robert.marskar@sintef.no>
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
11#ifndef EBGEOMETRY_SIGNEDDISTANCEFUNCTION_HPP
12#define EBGEOMETRY_SIGNEDDISTANCEFUNCTION_HPP
13
14// Std includes
15#include <type_traits>
16
17// Our includes
19#include "EBGeometry_Vec.hpp"
20
21namespace EBGeometry {
22
32template <class T>
34{
35 static_assert(std::is_floating_point_v<T>, "T must be a floating-point type");
36
37public:
42
46 ~SignedDistanceFunction() override = default;
47
53 [[nodiscard]] T
54 value(const Vec3T<T>& a_point) const noexcept final;
55
61 [[nodiscard]] virtual T
62 signedDistance(const Vec3T<T>& a_point) const noexcept = 0;
63
73 [[nodiscard]] inline virtual Vec3T<T>
74 normal(const Vec3T<T>& a_point, const T& a_delta) const noexcept;
75};
76
77} // namespace EBGeometry
78
79#include "EBGeometry_SignedDistanceFunctionImplem.hpp"
80
81#endif
Abstract base class for representing an implicit function.
Declaration of 2D and 3D point/vector classes with templated precision. Used with DCEL tools.
Abstract representation of an implicit function (not necessarily a signed distance function).
Definition EBGeometry_ImplicitFunction.hpp:32
Abstract representation of a signed distance function.
Definition EBGeometry_SignedDistanceFunction.hpp:34
~SignedDistanceFunction() override=default
Destructor.
SignedDistanceFunction()=default
Default constructor.
virtual Vec3T< T > normal(const Vec3T< T > &a_point, const T &a_delta) const noexcept
Compute the outward normal using central finite differences.
virtual T signedDistance(const Vec3T< T > &a_point) const noexcept=0
Pure virtual signed distance function to be implemented by subclasses.
T value(const Vec3T< T > &a_point) const noexcept final
Implementation of ImplicitFunction::value; delegates to signedDistance().
Three-dimensional vector class with arithmetic operators.
Definition EBGeometry_Vec.hpp:225
Namespace containing all of EBGeometry's functionality.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:31