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 BVHUnionIF() = delete;
418
423 BVHUnionIF(const std::vector<std::pair<std::shared_ptr<const P>, BV>>& a_primsAndBVs);
424
430 BVHUnionIF(const std::vector<std::shared_ptr<P>>& a_primitives, const std::vector<BV>& a_boundingVolumes);
431
435 ~BVHUnionIF() override = default;
436
444 [[nodiscard]] T
445 value(const Vec3T<T>& a_point) const noexcept override;
446
453
458 std::shared_ptr<EBGeometry::BVH::PackedBVH<T, P, K>> m_bvh;
459
465 inline void
466 buildTree(const std::vector<std::pair<std::shared_ptr<const P>, BV>>& a_primsAndBVs,
467 const BVH::Build a_build = BVH::Build::SAH) noexcept;
468};
469
480template <class T, class P, class BV, size_t K>
482{
483public:
484 static_assert(std::is_floating_point_v<T>, "BVHSmoothUnionIF requires a floating-point type T");
485 static_assert(std::is_base_of_v<EBGeometry::ImplicitFunction<T>, P>,
486 "BVHSmoothUnionIF requires an implicit function");
487 static_assert(K > 0, "BVHSmoothUnionIF BVH branching factor K must be positive");
488
493
498
506 BVHSmoothUnionIF(const std::vector<std::shared_ptr<P>>& a_distanceFunctions,
507 const std::vector<BV>& a_boundingVolumes,
508 const T a_smoothLen,
509 const std::function<T(const T&, const T&, const T&)> a_smoothMin = SmoothMin<T>) noexcept;
510
514 ~BVHSmoothUnionIF() override = default;
515
523 [[nodiscard]] T
524 value(const Vec3T<T>& a_point) const noexcept override;
525
532
537 std::shared_ptr<EBGeometry::BVH::PackedBVH<T, P, K>> m_bvh;
538
542 T m_smoothLen;
543
547 std::function<T(const T&, const T&, const T&)> m_smoothMin;
548
554 inline void
555 buildTree(const std::vector<std::pair<std::shared_ptr<const P>, BV>>& a_primsAndBVs,
556 const BVH::Build a_build = BVH::Build::SAH) noexcept;
557};
558
566template <class T>
568{
569public:
570 static_assert(std::is_floating_point_v<T>, "IntersectionIF requires a floating-point type T");
571
575 IntersectionIF() = delete;
576
581 IntersectionIF(const std::vector<std::shared_ptr<ImplicitFunction<T>>>& a_implicitFunctions) noexcept;
582
586 ~IntersectionIF() override = default;
587
594 [[nodiscard]] T
595 value(const Vec3T<T>& a_point) const noexcept override;
596
597protected:
601 std::vector<std::shared_ptr<const ImplicitFunction<T>>> m_implicitFunctions;
602};
603
611template <class T>
613{
614public:
615 static_assert(std::is_floating_point_v<T>, "SmoothIntersectionIF requires a floating-point type T");
616
621
630 const std::shared_ptr<ImplicitFunction<T>>& a_implicitFunctionB,
631 const T a_smoothLen,
632 const std::function<T(const T& a, const T& b, const T& s)>& a_smoothMax = SmoothMax<T>) noexcept;
633
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
647 ~SmoothIntersectionIF() override = default;
648
656 [[nodiscard]] T
657 value(const Vec3T<T>& a_point) const noexcept override;
658
659protected:
663 std::vector<std::shared_ptr<const ImplicitFunction<T>>> m_implicitFunctions;
664
669
673 std::function<T(const T& a, const T& b, const T& s)> m_smoothMax;
674};
675
682template <class T>
684{
685public:
686 static_assert(std::is_floating_point_v<T>, "DifferenceIF requires a floating-point type T");
687
691 DifferenceIF() = delete;
692
699 const std::shared_ptr<ImplicitFunction<T>>& a_implicitFunctionB) noexcept;
700
707 const std::vector<std::shared_ptr<ImplicitFunction<T>>>& a_implicitFunctionsB) noexcept;
708
712 ~DifferenceIF() override = default;
713
720 [[nodiscard]] T
721 value(const Vec3T<T>& a_point) const noexcept override;
722
723protected:
727 std::shared_ptr<ImplicitFunction<T>> m_implicitFunctionA;
728
732 std::shared_ptr<ImplicitFunction<T>> m_implicitFunctionB;
733};
734
742template <class T>
744{
745public:
746 static_assert(std::is_floating_point_v<T>, "SmoothDifferenceIF requires a floating-point type T");
747
752
761 const std::shared_ptr<ImplicitFunction<T>>& a_implicitFunctionB,
762 const T a_smoothLen,
763 const std::function<T(const T& a, const T& b, const T& s)>& a_smoothMax = SmoothMax<T>) noexcept;
764
773 const std::vector<std::shared_ptr<ImplicitFunction<T>>>& a_implicitFunctionsB,
774 const T a_smoothLen,
775 const std::function<T(const T& a, const T& b, const T& s)>& a_smoothMax = SmoothMax<T>) noexcept;
776
780 ~SmoothDifferenceIF() override = default;
781
788 [[nodiscard]] T
789 value(const Vec3T<T>& a_point) const noexcept override;
790
791protected:
795 std::shared_ptr<SmoothIntersectionIF<T>> m_smoothIntersectionIF;
796};
797
804template <class T>
806{
807public:
808 static_assert(std::is_floating_point_v<T>, "FiniteRepetitionIF requires a floating-point type T");
809
814
823 const Vec3T<T>& a_period,
824 const Vec3T<T>& a_repeatLo,
825 const Vec3T<T>& a_repeatHi) noexcept;
826
830 ~FiniteRepetitionIF() override = default;
831
837 [[nodiscard]] T
838 value(const Vec3T<T>& a_point) const noexcept override;
839
840protected:
845
850
855
859 std::shared_ptr<ImplicitFunction<T>> m_implicitFunction;
860};
861
862} // namespace EBGeometry
863
864#include "EBGeometry_CSGImplem.hpp"
865
866#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:482
~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.
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:458
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.
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:684
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:727
~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:732
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:806
std::shared_ptr< ImplicitFunction< T > > m_implicitFunction
Base implicit function to tile.
Definition EBGeometry_CSG.hpp:859
FiniteRepetitionIF()=delete
Disallowed, use the full constructor.
Vec3T< T > m_repeatLo
Repetition count for decreasing coordinate directions.
Definition EBGeometry_CSG.hpp:854
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:844
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:849
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:568
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:601
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:744
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:795
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:613
T m_smoothLen
Smoothing length.
Definition EBGeometry_CSG.hpp:668
std::vector< std::shared_ptr< const ImplicitFunction< T > > > m_implicitFunctions
Stored implicit functions.
Definition EBGeometry_CSG.hpp:663
~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:673
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...