EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
EBGeometry_CSG.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_CSG_HPP
12#define EBGEOMETRY_CSG_HPP
13
14// Std includes
15#include <algorithm>
16#include <cmath>
17#include <cstddef>
18#include <functional>
19#include <memory>
20#include <type_traits>
21#include <utility>
22#include <vector>
23
24// Our includes
25#include "EBGeometry_BVH.hpp"
27#include "EBGeometry_Macros.hpp"
28#include "EBGeometry_Vec.hpp"
29
30namespace EBGeometry {
31
40template <class T, class P = ImplicitFunction<T>>
41[[nodiscard]] std::shared_ptr<ImplicitFunction<T>>
42Union(const std::vector<std::shared_ptr<P>>& a_implicitFunctions);
43
53template <class T, class P1, class P2>
54[[nodiscard]] std::shared_ptr<ImplicitFunction<T>>
55Union(const std::shared_ptr<P1>& a_implicitFunctionA, const std::shared_ptr<P2>& a_implicitFunctionB);
56
66template <class T, class P = ImplicitFunction<T>>
67[[nodiscard]] std::shared_ptr<ImplicitFunction<T>>
68SmoothUnion(const std::vector<std::shared_ptr<P>>& a_implicitFunctions, const T a_smooth);
69
80template <class T, class P1, class P2>
81[[nodiscard]] std::shared_ptr<ImplicitFunction<T>>
82SmoothUnion(const std::shared_ptr<P1>& a_implicitFunctionA,
83 const std::shared_ptr<P2>& a_implicitFunctionB,
84 const T a_smooth);
85
99template <class T, class P, class BV, size_t K>
100[[nodiscard]] std::shared_ptr<ImplicitFunction<T>>
101BVHUnion(const std::vector<std::shared_ptr<P>>& a_implicitFunctions, const std::vector<BV>& a_boundingVolumes);
102
116template <class T, class P, class BV, size_t K>
117[[nodiscard]] std::shared_ptr<ImplicitFunction<T>>
118BVHSmoothUnion(const std::vector<std::shared_ptr<P>>& a_implicitFunctions,
119 const std::vector<BV>& a_boundingVolumes,
120 const T a_smoothLen) noexcept;
121
130template <class T, class P>
131[[nodiscard]] std::shared_ptr<ImplicitFunction<T>>
132Intersection(const std::vector<std::shared_ptr<P>>& a_implicitFunctions);
133
143template <class T, class P1, class P2>
144[[nodiscard]] std::shared_ptr<ImplicitFunction<T>>
145Intersection(const std::shared_ptr<P1>& a_implicitFunctionA, const std::shared_ptr<P2>& a_implicitFunctionB);
146
155template <class T, class P>
156[[nodiscard]] std::shared_ptr<ImplicitFunction<T>>
157SmoothIntersection(const std::vector<std::shared_ptr<P>>& a_implicitFunctions, const T a_smooth);
158
169template <class T, class P1, class P2>
170[[nodiscard]] std::shared_ptr<ImplicitFunction<T>>
171SmoothIntersection(const std::shared_ptr<P1>& a_implicitFunctionA,
172 const std::shared_ptr<P2>& a_implicitFunctionB,
173 const T a_smooth);
174
185template <class T, class P1 = ImplicitFunction<T>, class P2 = ImplicitFunction<T>>
186[[nodiscard]] std::shared_ptr<ImplicitFunction<T>>
187Difference(const std::shared_ptr<P1>& a_implicitFunctionA, const std::shared_ptr<P2>& a_implicitFunctionB);
188
200template <class T, class P1 = ImplicitFunction<T>, class P2 = ImplicitFunction<T>>
201[[nodiscard]] std::shared_ptr<ImplicitFunction<T>>
202SmoothDifference(const std::shared_ptr<P1>& a_implicitFunctionA,
203 const std::shared_ptr<P2>& a_implicitFunctionB,
204 const T a_smoothLen);
205
219template <class T, class P = ImplicitFunction<T>>
220[[nodiscard]] std::shared_ptr<ImplicitFunction<T>>
221FiniteRepetition(const std::shared_ptr<P>& a_implicitFunction,
222 const Vec3T<T>& a_period,
223 const Vec3T<T>& a_repeatLo,
224 const Vec3T<T>& a_repeatHi);
225
236template <class T>
237std::function<T(const T& a, const T& b, const T& s)> ExpMin = [](const T& a, const T& b, const T& s) -> T {
238 static_assert(std::is_floating_point_v<T>, "ExpMin requires a floating-point type T");
239
240 EBGEOMETRY_EXPECT(s > T(0));
241 T ret = std::exp(-a / s) + std::exp(-b / s);
242
243 return -std::log(ret) * s;
244};
245
256template <class T>
257std::function<T(const T& a, const T& b, const T& s)> SmoothMin = [](const T& a, const T& b, const T& s) -> T {
258 static_assert(std::is_floating_point_v<T>, "SmoothMin requires a floating-point type T");
259
260 EBGEOMETRY_EXPECT(s > T(0));
261 const T h = std::max(s - std::abs(a - b), T(0)) / s;
262
263 return std::min(a, b) - T(0.25) * h * h * s;
264};
265
276template <class T>
277std::function<T(const T& a, const T& b, const T& s)> SmoothMax = [](const T& a, const T& b, const T& s) -> T {
278 static_assert(std::is_floating_point_v<T>, "SmoothMax requires a floating-point type T");
279
280 EBGEOMETRY_EXPECT(s > T(0));
281 const T h = std::max(s - std::abs(a - b), T(0)) / s;
282
283 return std::max(a, b) + T(0.25) * h * h * s;
284};
285
293template <class T>
294class UnionIF : public ImplicitFunction<T>
295{
296public:
297 static_assert(std::is_floating_point_v<T>, "UnionIF requires a floating-point type T");
298
302 UnionIF() = delete;
303
308 UnionIF(const std::vector<std::shared_ptr<ImplicitFunction<T>>>& a_implicitFunctions);
309
313 ~UnionIF() override = default;
314
321 [[nodiscard]] T
322 value(const Vec3T<T>& a_point) const noexcept override;
323
324protected:
328 std::vector<std::shared_ptr<const ImplicitFunction<T>>> m_implicitFunctions;
329};
330
338template <class T>
340{
341public:
342 static_assert(std::is_floating_point_v<T>, "SmoothUnionIF requires a floating-point type T");
343
347 SmoothUnionIF() = delete;
348
355 SmoothUnionIF(const std::vector<std::shared_ptr<ImplicitFunction<T>>>& a_implicitFunctions,
356 const T a_smoothLen,
357 const std::function<T(const T& a, const T& b, const T& s)> a_smoothMin = SmoothMin<T>);
358
362 ~SmoothUnionIF() override = default;
363
371 [[nodiscard]] T
372 value(const Vec3T<T>& a_point) const noexcept override;
373
374protected:
378 std::vector<std::shared_ptr<const ImplicitFunction<T>>> m_implicitFunctions;
379
384
388 std::function<T(const T&, const T&, const T&)> m_smoothMin;
389};
390
401template <class T, class P, class BV, size_t K>
403{
404public:
405 static_assert(std::is_floating_point_v<T>, "BVHUnionIF requires a floating-point type T");
406 static_assert(std::is_base_of_v<EBGeometry::ImplicitFunction<T>, P>, "BVHUnionIF requires an implicit function");
407 static_assert(K > 0, "BVHUnionIF BVH branching factor K must be positive");
408
413
417 using Node = typename Root::Node;
418
422 BVHUnionIF() = delete;
423
428 BVHUnionIF(const std::vector<std::pair<std::shared_ptr<const P>, BV>>& a_primsAndBVs);
429
435 BVHUnionIF(const std::vector<std::shared_ptr<P>>& a_primitives, const std::vector<BV>& a_boundingVolumes);
436
440 ~BVHUnionIF() override = default;
441
449 [[nodiscard]] T
450 value(const Vec3T<T>& a_point) const noexcept override;
451
458
463 std::shared_ptr<EBGeometry::BVH::PackedBVH<T, P, K>> m_bvh;
464
470 inline void
471 buildTree(const std::vector<std::pair<std::shared_ptr<const P>, BV>>& a_primsAndBVs,
472 const BVH::Build a_build = BVH::Build::SAH) noexcept;
473};
474
485template <class T, class P, class BV, size_t K>
487{
488public:
489 static_assert(std::is_floating_point_v<T>, "BVHSmoothUnionIF requires a floating-point type T");
490 static_assert(std::is_base_of_v<EBGeometry::ImplicitFunction<T>, P>,
491 "BVHSmoothUnionIF requires an implicit function");
492 static_assert(K > 0, "BVHSmoothUnionIF BVH branching factor K must be positive");
493
498
502 using Node = typename Root::Node;
503
508
516 BVHSmoothUnionIF(const std::vector<std::shared_ptr<P>>& a_distanceFunctions,
517 const std::vector<BV>& a_boundingVolumes,
518 const T a_smoothLen,
519 const std::function<T(const T&, const T&, const T&)> a_smoothMin = SmoothMin<T>) noexcept;
520
524 ~BVHSmoothUnionIF() override = default;
525
533 [[nodiscard]] T
534 value(const Vec3T<T>& a_point) const noexcept override;
535
542
547 std::shared_ptr<EBGeometry::BVH::PackedBVH<T, P, K>> m_bvh;
548
552 T m_smoothLen;
553
557 std::function<T(const T&, const T&, const T&)> m_smoothMin;
558
564 inline void
565 buildTree(const std::vector<std::pair<std::shared_ptr<const P>, BV>>& a_primsAndBVs,
566 const BVH::Build a_build = BVH::Build::SAH) noexcept;
567};
568
576template <class T>
578{
579public:
580 static_assert(std::is_floating_point_v<T>, "IntersectionIF requires a floating-point type T");
581
585 IntersectionIF() = delete;
586
591 IntersectionIF(const std::vector<std::shared_ptr<ImplicitFunction<T>>>& a_implicitFunctions) noexcept;
592
596 ~IntersectionIF() override = default;
597
604 [[nodiscard]] T
605 value(const Vec3T<T>& a_point) const noexcept override;
606
607protected:
611 std::vector<std::shared_ptr<const ImplicitFunction<T>>> m_implicitFunctions;
612};
613
621template <class T>
623{
624public:
625 static_assert(std::is_floating_point_v<T>, "SmoothIntersectionIF requires a floating-point type T");
626
631
640 const std::shared_ptr<ImplicitFunction<T>>& a_implicitFunctionB,
641 const T a_smoothLen,
642 const std::function<T(const T& a, const T& b, const T& s)>& a_smoothMax = SmoothMax<T>) noexcept;
643
651 const T a_smoothLen,
652 const std::function<T(const T& a, const T& b, const T& s)>& a_smoothMax = SmoothMax<T>) noexcept;
653
657 ~SmoothIntersectionIF() override = default;
658
666 [[nodiscard]] T
667 value(const Vec3T<T>& a_point) const noexcept override;
668
669protected:
673 std::vector<std::shared_ptr<const ImplicitFunction<T>>> m_implicitFunctions;
674
679
683 std::function<T(const T& a, const T& b, const T& s)> m_smoothMax;
684};
685
692template <class T>
694{
695public:
696 static_assert(std::is_floating_point_v<T>, "DifferenceIF requires a floating-point type T");
697
701 DifferenceIF() = delete;
702
709 const std::shared_ptr<ImplicitFunction<T>>& a_implicitFunctionB) noexcept;
710
717 const std::vector<std::shared_ptr<ImplicitFunction<T>>>& a_implicitFunctionsB) noexcept;
718
722 ~DifferenceIF() override = default;
723
730 [[nodiscard]] T
731 value(const Vec3T<T>& a_point) const noexcept override;
732
733protected:
737 std::shared_ptr<ImplicitFunction<T>> m_implicitFunctionA;
738
742 std::shared_ptr<ImplicitFunction<T>> m_implicitFunctionB;
743};
744
752template <class T>
754{
755public:
756 static_assert(std::is_floating_point_v<T>, "SmoothDifferenceIF requires a floating-point type T");
757
762
771 const std::shared_ptr<ImplicitFunction<T>>& a_implicitFunctionB,
772 const T a_smoothLen,
773 const std::function<T(const T& a, const T& b, const T& s)>& a_smoothMax = SmoothMax<T>) noexcept;
774
783 const std::vector<std::shared_ptr<ImplicitFunction<T>>>& a_implicitFunctionsB,
784 const T a_smoothLen,
785 const std::function<T(const T& a, const T& b, const T& s)>& a_smoothMax = SmoothMax<T>) noexcept;
786
790 ~SmoothDifferenceIF() override = default;
791
798 [[nodiscard]] T
799 value(const Vec3T<T>& a_point) const noexcept override;
800
801protected:
805 std::shared_ptr<SmoothIntersectionIF<T>> m_smoothIntersectionIF;
806};
807
814template <class T>
816{
817public:
818 static_assert(std::is_floating_point_v<T>, "FiniteRepetitionIF requires a floating-point type T");
819
824
833 const Vec3T<T>& a_period,
834 const Vec3T<T>& a_repeatLo,
835 const Vec3T<T>& a_repeatHi) noexcept;
836
840 ~FiniteRepetitionIF() override = default;
841
847 [[nodiscard]] T
848 value(const Vec3T<T>& a_point) const noexcept override;
849
850protected:
855
860
865
869 std::shared_ptr<ImplicitFunction<T>> m_implicitFunction;
870};
871
872} // namespace EBGeometry
873
874#include "EBGeometry_CSGImplem.hpp"
875
876#endif
Declaration of bounding volume hierarchy (BVH) classes.
Abstract base class for representing an implicit function.
Utility macros for EBGeometry.
#define EBGEOMETRY_EXPECT(cond)
Runtime precondition assertion for EBGeometry.
Definition EBGeometry_Macros.hpp:62
Declaration of 2D and 3D point/vector classes with templated precision. Used with DCEL tools.
BVH-accelerated smooth union of implicit functions.
Definition EBGeometry_CSG.hpp:487
~BVHSmoothUnionIF() override=default
Destructor.
BVHSmoothUnionIF(const std::vector< std::shared_ptr< P > > &a_distanceFunctions, const std::vector< BV > &a_boundingVolumes, const T a_smoothLen, const std::function< T(const T &, const T &, const T &)> a_smoothMin=SmoothMin< T >) noexcept
Constructs the BVH-accelerated smooth union.
const EBGeometry::BoundingVolumes::AABBT< T > & getBoundingVolume() const noexcept
Returns the axis-aligned bounding box enclosing all primitives.
typename Root::Node Node
Alias for a BVH node.
Definition EBGeometry_CSG.hpp:502
BVHSmoothUnionIF()=delete
Disallowed, use the full constructor.
T value(const Vec3T< T > &a_point) const noexcept override
Evaluates the smoothly blended signed distance at a_point using BVH traversal.
BVH-accelerated union of implicit functions.
Definition EBGeometry_CSG.hpp:403
BVHUnionIF(const std::vector< std::shared_ptr< P > > &a_primitives, const std::vector< BV > &a_boundingVolumes)
Constructs the BVH-accelerated union from separate primitive and bounding-volume lists.
T value(const Vec3T< T > &a_point) const noexcept override
Evaluates the signed distance at a_point using BVH traversal.
const EBGeometry::BoundingVolumes::AABBT< T > & getBoundingVolume() const noexcept
Returns the axis-aligned bounding box enclosing all primitives.
BVHUnionIF()=delete
Disallowed, use the full constructor.
~BVHUnionIF() override=default
Destructor.
std::shared_ptr< EBGeometry::BVH::PackedBVH< T, P, K > > m_bvh
Flat BVH over all input primitives.
Definition EBGeometry_CSG.hpp:463
BVHUnionIF(const std::vector< std::pair< std::shared_ptr< const P >, BV > > &a_primsAndBVs)
Constructs the BVH-accelerated union from pre-paired primitives and bounding volumes.
typename Root::Node Node
Alias for a BVH node.
Definition EBGeometry_CSG.hpp:417
void buildTree(const std::vector< std::pair< std::shared_ptr< const P >, BV > > &a_primsAndBVs, const BVH::Build a_build=BVH::Build::SAH) noexcept
Builds the internal BVH from primitive/BV pairs.
Axis-aligned bounding box (AABB) enclosing a set of 3D points.
Definition EBGeometry_BoundingVolumes.hpp:247
Implicit function whose interior is the set difference A \ B.
Definition EBGeometry_CSG.hpp:694
DifferenceIF(const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunctionA, const std::vector< std::shared_ptr< ImplicitFunction< T > > > &a_implicitFunctionsB) noexcept
Constructs A \ union(Bs) from A and a list of subtrahends.
std::shared_ptr< ImplicitFunction< T > > m_implicitFunctionA
Minuend implicit function.
Definition EBGeometry_CSG.hpp:737
~DifferenceIF() override=default
Destructor.
std::shared_ptr< ImplicitFunction< T > > m_implicitFunctionB
Subtrahend implicit function (may wrap a union of multiple subtrahends).
Definition EBGeometry_CSG.hpp:742
DifferenceIF(const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunctionA, const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunctionB) noexcept
Constructs A \ B from two implicit functions.
T value(const Vec3T< T > &a_point) const noexcept override
Evaluates the signed distance at a_point.
DifferenceIF()=delete
Disallowed, use the full constructor.
Implicit function that tiles a base function periodically within a finite repetition count.
Definition EBGeometry_CSG.hpp:816
std::shared_ptr< ImplicitFunction< T > > m_implicitFunction
Base implicit function to tile.
Definition EBGeometry_CSG.hpp:869
FiniteRepetitionIF()=delete
Disallowed, use the full constructor.
Vec3T< T > m_repeatLo
Repetition count for decreasing coordinate directions.
Definition EBGeometry_CSG.hpp:864
T value(const Vec3T< T > &a_point) const noexcept override
Evaluates the signed distance at a_point by folding into the nearest tile.
~FiniteRepetitionIF() override=default
Destructor.
Vec3T< T > m_period
Tile period in each coordinate direction.
Definition EBGeometry_CSG.hpp:854
FiniteRepetitionIF(const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction, const Vec3T< T > &a_period, const Vec3T< T > &a_repeatLo, const Vec3T< T > &a_repeatHi) noexcept
Constructs the periodically tiled implicit function.
Vec3T< T > m_repeatHi
Repetition count for increasing coordinate directions.
Definition EBGeometry_CSG.hpp:859
Abstract representation of an implicit function (not necessarily a signed distance function).
Definition EBGeometry_ImplicitFunction.hpp:32
Implicit function whose interior is the intersection of all input function interiors.
Definition EBGeometry_CSG.hpp:578
T value(const Vec3T< T > &a_point) const noexcept override
Evaluates the signed distance at a_point.
std::vector< std::shared_ptr< const ImplicitFunction< T > > > m_implicitFunctions
Stored implicit functions.
Definition EBGeometry_CSG.hpp:611
IntersectionIF(const std::vector< std::shared_ptr< ImplicitFunction< T > > > &a_implicitFunctions) noexcept
Constructs the intersection of the given implicit functions.
~IntersectionIF() override=default
Destructor.
IntersectionIF()=delete
Disallowed, use the full constructor.
Implicit function representing a smoothly blended set difference A \ B.
Definition EBGeometry_CSG.hpp:754
SmoothDifferenceIF(const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunctionA, const std::vector< std::shared_ptr< ImplicitFunction< T > > > &a_implicitFunctionsB, const T a_smoothLen, const std::function< T(const T &a, const T &b, const T &s)> &a_smoothMax=SmoothMax< T >) noexcept
Constructs the smooth difference A \ union(Bs) from A and a list of subtrahends.
~SmoothDifferenceIF() override=default
Destructor.
std::shared_ptr< SmoothIntersectionIF< T > > m_smoothIntersectionIF
Internal smooth intersection implementing smooth(A ∩ complement(B)).
Definition EBGeometry_CSG.hpp:805
SmoothDifferenceIF()=delete
Disallowed, use the full constructor.
SmoothDifferenceIF(const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunctionA, const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunctionB, const T a_smoothLen, const std::function< T(const T &a, const T &b, const T &s)> &a_smoothMax=SmoothMax< T >) noexcept
Constructs the smooth difference A \ B from two implicit functions.
T value(const Vec3T< T > &a_point) const noexcept override
Evaluates the smoothly blended signed distance at a_point.
Implicit function whose interior is a smoothly blended intersection of all input function interiors.
Definition EBGeometry_CSG.hpp:623
T m_smoothLen
Smoothing length.
Definition EBGeometry_CSG.hpp:678
std::vector< std::shared_ptr< const ImplicitFunction< T > > > m_implicitFunctions
Stored implicit functions.
Definition EBGeometry_CSG.hpp:673
~SmoothIntersectionIF() override=default
Destructor.
SmoothIntersectionIF()=delete
Disallowed, use the full constructor.
std::function< T(const T &a, const T &b, const T &s)> m_smoothMax
Smooth-maximum operator.
Definition EBGeometry_CSG.hpp:683
SmoothIntersectionIF(const std::vector< std::shared_ptr< ImplicitFunction< T > > > &a_implicitFunctions, const T a_smoothLen, const std::function< T(const T &a, const T &b, const T &s)> &a_smoothMax=SmoothMax< T >) noexcept
Constructs the smooth intersection of a list of implicit functions.
T value(const Vec3T< T > &a_point) const noexcept override
Evaluates the smoothly blended signed distance at a_point.
SmoothIntersectionIF(const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunctionA, const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunctionB, const T a_smoothLen, const std::function< T(const T &a, const T &b, const T &s)> &a_smoothMax=SmoothMax< T >) noexcept
Constructs the smooth intersection of two implicit functions.
Implicit function whose interior is a smoothly blended union of all input function interiors.
Definition EBGeometry_CSG.hpp:340
SmoothUnionIF()=delete
Disallowed, use the full constructor.
SmoothUnionIF(const std::vector< std::shared_ptr< ImplicitFunction< T > > > &a_implicitFunctions, const T a_smoothLen, const std::function< T(const T &a, const T &b, const T &s)> a_smoothMin=SmoothMin< T >)
Constructs the smooth union of the given implicit functions.
T value(const Vec3T< T > &a_point) const noexcept override
Evaluates the smoothly blended signed distance at a_point.
T m_smoothLen
Smoothing length.
Definition EBGeometry_CSG.hpp:383
std::vector< std::shared_ptr< const ImplicitFunction< T > > > m_implicitFunctions
Stored implicit functions.
Definition EBGeometry_CSG.hpp:378
std::function< T(const T &, const T &, const T &)> m_smoothMin
Smooth-minimum operator.
Definition EBGeometry_CSG.hpp:388
~SmoothUnionIF() override=default
Destructor.
Implicit function whose interior is the union of all input function interiors.
Definition EBGeometry_CSG.hpp:295
std::vector< std::shared_ptr< const ImplicitFunction< T > > > m_implicitFunctions
Stored implicit functions.
Definition EBGeometry_CSG.hpp:328
~UnionIF() override=default
Destructor.
UnionIF()=delete
Disallowed, use the full constructor.
UnionIF(const std::vector< std::shared_ptr< ImplicitFunction< T > > > &a_implicitFunctions)
Constructs the union of the given implicit functions.
T value(const Vec3T< T > &a_point) const noexcept override
Evaluates the signed distance at a_point.
Three-dimensional vector class with arithmetic operators.
Definition EBGeometry_Vec.hpp:225
Namespace containing all of EBGeometry's functionality.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:31
std::shared_ptr< ImplicitFunction< T > > SmoothUnion(const std::vector< std::shared_ptr< P > > &a_implicitFunctions, const T a_smooth)
Constructs an implicit function whose interior is a smoothly blended union of all input function inte...
std::shared_ptr< ImplicitFunction< T > > Difference(const std::shared_ptr< P1 > &a_implicitFunctionA, const std::shared_ptr< P2 > &a_implicitFunctionB)
Constructs an implicit function whose interior is the set difference A \ B.
std::shared_ptr< ImplicitFunction< T > > Union(const std::vector< std::shared_ptr< P > > &a_implicitFunctions)
Constructs an implicit function whose interior is the union of the interiors of all input functions.
std::shared_ptr< ImplicitFunction< T > > FiniteRepetition(const std::shared_ptr< P > &a_implicitFunction, const Vec3T< T > &a_period, const Vec3T< T > &a_repeatLo, const Vec3T< T > &a_repeatHi)
Constructs a periodically tiled implicit function with finite extent.
std::shared_ptr< ImplicitFunction< T > > BVHSmoothUnion(const std::vector< std::shared_ptr< P > > &a_implicitFunctions, const std::vector< BV > &a_boundingVolumes, const T a_smoothLen) noexcept
Constructs a BVH-accelerated smooth union of implicit functions.
std::function< T(const T &a, const T &b, const T &s)> SmoothMin
Quadratic polynomial smooth minimum for blending two signed-distance values.
Definition EBGeometry_CSG.hpp:257
std::function< T(const T &a, const T &b, const T &s)> ExpMin
Exponential smooth minimum for blending two signed-distance values.
Definition EBGeometry_CSG.hpp:237
std::shared_ptr< ImplicitFunction< T > > BVHUnion(const std::vector< std::shared_ptr< P > > &a_implicitFunctions, const std::vector< BV > &a_boundingVolumes)
Constructs a BVH-accelerated union of implicit functions.
std::shared_ptr< ImplicitFunction< T > > SmoothDifference(const std::shared_ptr< P1 > &a_implicitFunctionA, const std::shared_ptr< P2 > &a_implicitFunctionB, const T a_smoothLen)
Constructs an implicit function representing a smoothly blended set difference A \ B.
std::shared_ptr< ImplicitFunction< T > > SmoothIntersection(const std::vector< std::shared_ptr< P > > &a_implicitFunctions, const T a_smooth)
Constructs an implicit function whose interior is a smoothly blended intersection of all input functi...
std::function< T(const T &a, const T &b, const T &s)> SmoothMax
Quadratic polynomial smooth maximum for blending two signed-distance values.
Definition EBGeometry_CSG.hpp:277
std::shared_ptr< ImplicitFunction< T > > Intersection(const std::vector< std::shared_ptr< P > > &a_implicitFunctions)
Constructs an implicit function whose interior is the intersection of the interiors of all input func...