28template <
class T,
class P = ImplicitFunction<T>>
29std::shared_ptr<ImplicitFunction<T>>
38template <
class T,
class P1,
class P2>
39std::shared_ptr<ImplicitFunction<T>>
48template <
class T,
class P = ImplicitFunction<T>>
49std::shared_ptr<ImplicitFunction<T>>
59template <
class T,
class P1,
class P2>
60std::shared_ptr<ImplicitFunction<T>>
71template <
class T,
class P,
class BV,
size_t K>
72std::shared_ptr<ImplicitFunction<T>>
83template <
class T,
class P,
class BV,
size_t K>
84std::shared_ptr<ImplicitFunction<T>>
94template <
class T,
class P>
95std::shared_ptr<ImplicitFunction<T>>
104template <
class T,
class P1,
class P2>
105std::shared_ptr<ImplicitFunction<T>>
115template <
class T,
class P>
116std::shared_ptr<ImplicitFunction<T>>
126template <
class T,
class P1,
class P2>
127std::shared_ptr<ImplicitFunction<T>>
138template <
class T,
class P1 = ImplicitFunction<T>,
class P2 = ImplicitFunction<T>>
139std::shared_ptr<ImplicitFunction<T>>
149template <
class T,
class P1 = ImplicitFunction<T>,
class P2 = ImplicitFunction<T>>
150std::shared_ptr<ImplicitFunction<T>>
163template <
class T,
class P = ImplicitFunction<T>>
164std::shared_ptr<ImplicitFunction<T>>
191 const T h = std::max(
s - std::abs(
a -
b), 0.0) /
s;
193 return std::min(
a,
b) - 0.25 *
h *
h *
s;
204 const T h = std::max(
s - std::abs(
a -
b), 0.0) /
s;
206 return std::max(
a,
b) + 0.25 *
h *
h *
s;
300template <
class T,
class P,
class BV,
size_t K>
304 static_assert(std::is_base_of<EBGeometry::ImplicitFunction<T>,
P>
::value,
305 "FastUnionIF requires an implicit function");
310 using Root =
typename EBGeometry::BVH::LinearBVH<T, P, BV, K>;
315 using Node =
typename Root::LinearNode;
378 static_assert(std::is_base_of<EBGeometry::ImplicitFunction<T>,
P>
::value,
379 "FastSmoothUnionIF requires an implicit function");
384 using Root =
typename EBGeometry::BVH::LinearBVH<T, P, BV, K>;
389 using Node =
typename Root::LinearNode;
701#include "EBGeometry_CSGImplem.hpp"
std::function< T(const T &a, const T &b, const T &s)> expMin
Exponential minimum function for CSG.
Definition EBGeometry_CSG.hpp:177
std::shared_ptr< ImplicitFunction< T > > Union(const std::vector< std::shared_ptr< P > > &a_implicitFunctions) noexcept
Convenience function for taking the union of a bunch of a implicit 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) noexcept
Convenience function for creating a periodically repeated implicit function (FiniteRepetitionIF).
std::shared_ptr< ImplicitFunction< T > > SmoothDifference(const std::shared_ptr< P1 > &a_implicitFunctionA, const std::shared_ptr< P2 > &a_implicitFunctionB, const T a_smoothLen) noexcept
Convenience function for taking the smooth CSG difference.
std::shared_ptr< ImplicitFunction< T > > SmoothIntersection(const std::vector< std::shared_ptr< P > > &a_implicitFunctions, const T a_smooth) noexcept
Convenience function for taking the smooth intersection of a bunch of a implicit functions.
std::shared_ptr< ImplicitFunction< T > > FastSmoothUnion(const std::vector< std::shared_ptr< P > > &a_implicitFunctions, const std::vector< BV > &a_boundingVolumes, const T a_smoothLen) noexcept
Convenience function for taking the BVH-accelerated union of a bunch of a implicit functions.
std::function< T(const T &a, const T &b, const T &s)> smoothMin
Smooth minimum function for CSG.
Definition EBGeometry_CSG.hpp:190
std::shared_ptr< ImplicitFunction< T > > Intersection(const std::vector< std::shared_ptr< P > > &a_implicitFunctions) noexcept
Convenience function for taking the intersection of a bunch of a implicit functions.
std::shared_ptr< ImplicitFunction< T > > FastUnion(const std::vector< std::shared_ptr< P > > &a_implicitFunctions, const std::vector< BV > &a_boundingVolumes) noexcept
Convenience function for taking the BVH-accelerated union of a bunch of a implicit functions.
std::shared_ptr< ImplicitFunction< T > > SmoothUnion(const std::vector< std::shared_ptr< P > > &a_implicitFunctions, const T a_smooth) noexcept
Convenience function for taking the union of a bunch of a implicit functions.
std::function< T(const T &a, const T &b, const T &s)> smoothMax
Smooth maximum function for CSG.
Definition EBGeometry_CSG.hpp:203
std::shared_ptr< ImplicitFunction< T > > Difference(const std::shared_ptr< P1 > &a_implicitFunctionA, const std::shared_ptr< P2 > &a_implicitFunctionB) noexcept
Convenience function for taking the CSG difference.
Abstract base class for representing an implicit function.
CSG difference between two implicit functions.
Definition EBGeometry_CSG.hpp:537
DifferenceIF(const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunctionA, const std::vector< std::shared_ptr< ImplicitFunction< T > > > &a_implicitFunctionsB) noexcept
Full constructor. Computes the CSG difference between A and the union of the B's.
std::shared_ptr< ImplicitFunction< T > > m_implicitFunctionA
First implicit function.
Definition EBGeometry_CSG.hpp:576
DifferenceIF(const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunctionA, const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunctionB) noexcept
Full constructor. Computes the CSG difference.
virtual ~DifferenceIF()=default
Destructor (does nothing)
DifferenceIF()=delete
Disallowed, use the full constructor.
std::shared_ptr< ImplicitFunction< T > > m_implicitFunctionB
Subtracted implicit function.
Definition EBGeometry_CSG.hpp:581
T value(const Vec3T< T > &a_point) const noexcept override
Value function.
Implicit function smoothed union using BVHs.
Definition EBGeometry_CSG.hpp:376
FastSmoothUnionIF(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
Full constructor - constructs bounding volumes in place.
typename Root::LinearNode Node
Alias for linear BVH node.
Definition EBGeometry_CSG.hpp:389
FastSmoothUnionIF()=delete
Disallowed, use the full constructor.
T m_smoothLen
Smoothing length.
Definition EBGeometry_CSG.hpp:424
typename EBGeometry::BVH::LinearBVH< T, P, BV, K > Root
Alias for linear BVH type.
Definition EBGeometry_CSG.hpp:384
virtual ~FastSmoothUnionIF()=default
Destructor (does nothing)
std::function< T(const T &, const T &, const T &)> m_smoothMin
Smooth min operator.
Definition EBGeometry_CSG.hpp:429
virtual T value(const Vec3T< T > &a_point) const noexcept override
Value function.
Implicit function union using BVHs.
Definition EBGeometry_CSG.hpp:302
FastUnionIF(const std::vector< std::pair< std::shared_ptr< const P >, BV > > &a_primsAndBVs) noexcept
Full constructor - constructs bounding volumes in place.
FastUnionIF(const std::vector< std::shared_ptr< P > > &a_primitives, const std::vector< BV > &a_boundingVolumes) noexcept
Full constructor - constructs bounding volumes in place.
void buildTree(const std::vector< std::pair< std::shared_ptr< const P >, BV > > &a_primsAndBVs, const BVH::Build a_build=BVH::Build::TopDown) noexcept
Build BVH tree for the input objects.
FastUnionIF()=delete
Disallowed, use the full constructor.
std::shared_ptr< EBGeometry::BVH::LinearBVH< T, P, BV, K > > m_bvh
Root node for linearized BVH tree.
Definition EBGeometry_CSG.hpp:357
typename EBGeometry::BVH::LinearBVH< T, P, BV, K > Root
Alias for linear BVH type.
Definition EBGeometry_CSG.hpp:310
const BV & getBoundingVolume() const noexcept
Get the bounding volume.
typename Root::LinearNode Node
Alias for linear BVH node.
Definition EBGeometry_CSG.hpp:315
virtual T value(const Vec3T< T > &a_point) const noexcept override
Value function.
virtual ~FastUnionIF()=default
Destructor (does nothing)
Class which creates a periodic repetition of an implicit function.
Definition EBGeometry_CSG.hpp:646
virtual ~FiniteRepetitionIF()=default
Destructor (does nothing)
std::shared_ptr< ImplicitFunction< T > > m_implicitFunction
Underlying implicit function.
Definition EBGeometry_CSG.hpp:696
Vec3T< T > m_repeatLo
Number of repetition over increasing coordinate direction.
Definition EBGeometry_CSG.hpp:691
Vec3T< T > m_repeatHi
Number of repetition over increasing coordinate direction.
Definition EBGeometry_CSG.hpp:686
T value(const Vec3T< T > &a_point) const noexcept override
Value function.
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
Full constructor.
FiniteRepetitionIF()=delete
Disallowed - use the full constructor.
Vec3T< T > m_period
Repetition period.
Definition EBGeometry_CSG.hpp:681
Abstract representation of an implicit function function (not necessarily signed distance).
Definition EBGeometry_ImplicitFunction.hpp:27
CSG intersection. Computes the maximum value of all input primitives.
Definition EBGeometry_CSG.hpp:437
IntersectionIF(const std::vector< std::shared_ptr< ImplicitFunction< T > > > &a_implicitFunctions) noexcept
Full constructor. Computes the CSG intersection.
T value(const Vec3T< T > &a_point) const noexcept override
Value function.
IntersectionIF()=delete
Disallowed, use the full constructor.
std::vector< std::shared_ptr< const ImplicitFunction< T > > > m_implicitFunctions
List of primitives.
Definition EBGeometry_CSG.hpp:466
virtual ~IntersectionIF()=default
Destructor (does nothing)
CSG difference between two implicit functions.
Definition EBGeometry_CSG.hpp:589
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
Full constructor. Computes the smooth CSG difference.
virtual ~SmoothDifferenceIF()=default
Destructor (does nothing)
SmoothDifferenceIF()=delete
Disallowed, use the full constructor.
T value(const Vec3T< T > &a_point) const noexcept override
Value function.
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
Full constructor. Computes the CSG difference between A and the union of the B's.
std::shared_ptr< SmoothIntersectionIF< T > > m_smoothIntersectionIF
Resulting smooth intersection.
Definition EBGeometry_CSG.hpp:636
Smooth intersection.
Definition EBGeometry_CSG.hpp:474
std::vector< std::shared_ptr< const ImplicitFunction< T > > > m_implicitFunctions
List of primitives.
Definition EBGeometry_CSG.hpp:519
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
Full constructor. Computes the CSG intersection.
std::function< T(const T &a, const T &b, const T &s)> m_smoothMax
Smooth max operator.
Definition EBGeometry_CSG.hpp:529
SmoothIntersectionIF()=delete
Disallowed, use the full constructor.
T m_smoothLen
Smoothing parameter.
Definition EBGeometry_CSG.hpp:524
T value(const Vec3T< T > &a_point) const noexcept override
Value function.
virtual ~SmoothIntersectionIF()=default
Destructor (does nothing)
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
Full constructor. Computes the CSG intersection.
Smooth CSG union. Computes the minimum value of all input primitives.
Definition EBGeometry_CSG.hpp:251
T value(const Vec3T< T > &a_point) const noexcept override
Value function.
SmoothUnionIF()=delete
Disallowed, use the full constructor.
std::vector< std::shared_ptr< const ImplicitFunction< T > > > m_implicitFunctions
List of primitives.
Definition EBGeometry_CSG.hpp:284
std::function< T(const T &, const T &, const T &)> m_smoothMin
Function for taking the smooth minimum.
Definition EBGeometry_CSG.hpp:294
T m_smoothLen
Smoothing parameter.
Definition EBGeometry_CSG.hpp:289
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 >) noexcept
Full constructor. Computes the CSG union.
virtual ~SmoothUnionIF()=default
Destructor (does nothing)
CSG union. Computes the minimum value of all input primitives.
Definition EBGeometry_CSG.hpp:214
UnionIF(const std::vector< std::shared_ptr< ImplicitFunction< T > > > &a_implicitFunctions) noexcept
Full constructor. Computes the CSG union.
virtual ~UnionIF()=default
Destructor (does nothing)
std::vector< std::shared_ptr< const ImplicitFunction< T > > > m_implicitFunctions
List of primitives.
Definition EBGeometry_CSG.hpp:243
UnionIF()=delete
Disallowed, use the full constructor.
T value(const Vec3T< T > &a_point) const noexcept override
Value function.
Three-dimensional vector class with arithmetic operators.
Definition EBGeometry_Vec.hpp:218
Namespace for various bounding volume hierarchy (BVH) functionality.
Definition EBGeometry_BVH.hpp:30
Name space for all of EBGeometry.
Definition EBGeometry.hpp:23