EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Namespaces | Classes | Functions | Variables
EBGeometry Namespace Reference

Namespace containing all of EBGeometry's functionality. More...

Namespaces

namespace  BoundingVolumes
 Namespace encapsulating bounding volume types for use with bounding volume hierarchies.
 
namespace  BVH
 Namespace for various bounding volume hierarchy (BVH) functionalities.
 
namespace  DCEL
 Namespace containing various double-connected edge list (DCEL) functionality.
 
namespace  Octree
 Namespace for octree functionality.
 
namespace  Parser
 Namespace which encapsulates possible file parsers for building EBGeometry data structures.
 
namespace  PointSoA
 Namespace for PointSoAT-related compile-time utilities.
 
namespace  Random
 Namespace for random sampling utilities (a single, centralized home for RNG use).
 
namespace  SFC
 Namespace for space-filling curves (SFCs) used to linearly order 3D grid cells.
 
namespace  Soup
 Namespace containing basic functionality for turning planar-polygon soups into DCEL meshes.
 
namespace  TriangleSoA
 Namespace for TriangleSoAT-related compile-time utilities.
 

Classes

class  AnnularIF
 Annular implicit function. Creates a shell out of the implicit function. More...
 
class  BlurIF
 Blurred/interpolated implicit function — can be used for smoothing. More...
 
class  BoxSDF
 Signed distance field for an axis-aligned box (AABB). More...
 
class  BVHSmoothUnionIF
 BVH-accelerated smooth union of implicit functions. More...
 
class  BVHUnionIF
 BVH-accelerated union of implicit functions. More...
 
class  CapsuleSDF
 Signed distance field for a capsule (pill shape): a cylinder capped with hemispheres. More...
 
class  ComplementIF
 Complemented implicit function. More...
 
class  ConeSDF
 Signed distance field for a finite cone. More...
 
class  CylinderSDF
 Signed distance field for a finite, flat-capped cylinder. More...
 
class  DifferenceIF
 Implicit function whose interior is the set difference A \ B. More...
 
class  ElongateIF
 Implicit function which is an elongation of another implicit function along each axis. More...
 
class  FiniteRepetitionIF
 Implicit function that tiles a base function periodically within a finite repetition count. More...
 
class  FlatMeshSDF
 Signed distance function for a DCEL mesh. Does not use BVHs. More...
 
class  ImplicitFunction
 Abstract representation of an implicit function (not necessarily a signed distance function). More...
 
class  InfiniteConeSDF
 Signed distance field for an infinite cone. More...
 
class  InfiniteCylinderSDF
 Signed distance field for an infinitely long cylinder. More...
 
class  IntersectionIF
 Implicit function whose interior is the intersection of all input function interiors. More...
 
class  MeshSDF
 Signed distance function for a DCEL mesh. Stores the mesh in a PackedBVH for SIMD-accelerated traversal. Accepts any polygon, not just triangles. More...
 
class  MollifyIF
 Mollified implicit function. More...
 
class  OBJ
 Class for storing contents of Wavefront OBJ files. More...
 
class  OffsetIF
 Offset implicit function. Offsets (grows or shrinks) the implicit function by a constant. More...
 
class  PerlinSDF
 Ken Perlin's gradient-noise implicit function. More...
 
class  PlaneSDF
 Signed distance function for a plane. More...
 
class  PLY
 Class for storing Stanford PLY meshes. More...
 
struct  PointAoSoA
 Metadata-carrying wrapper around a single PointSoAT<T, W>. More...
 
class  PointCloudBVH
 A PackedBVH specialized for point clouds, with a fast build and turnkey queries. More...
 
class  PointCloudHashGrid
 A uniform spatial grid specialized for point clouds, with a fast build and turnkey queries. More...
 
struct  PointSoAT
 True SoA (Structure of Arrays) layout for W point positions, enabling SIMD distance evaluation against the whole group at once. More...
 
class  Polygon2D
 Class for embedding a polygon face into 2D. More...
 
class  ReflectIF
 Implicit function which is a reflection of another implicit function. More...
 
class  RotateIF
 Rotated implicit function. Rotates an implicit function about an axis. More...
 
class  RoundedBoxSDF
 Signed distance field for an axis-aligned box with rounded corners. More...
 
class  RoundedCylinderSDF
 Signed distance field for a cylinder with rounded (toroidal) edges. More...
 
class  ScaleIF
 Uniformly scaled implicit function. More...
 
class  SignedDistanceFunction
 Abstract representation of a signed distance function. More...
 
class  SimpleTimer
 Simple timer class used for local performance profiling. More...
 
class  SmoothDifferenceIF
 Implicit function representing a smoothly blended set difference A \ B. More...
 
class  SmoothIntersectionIF
 Implicit function whose interior is a smoothly blended intersection of all input function interiors. More...
 
class  SmoothUnionIF
 Implicit function whose interior is a smoothly blended union of all input function interiors. More...
 
class  SphereSDF
 Signed distance field for a sphere. More...
 
class  STL
 Class for storing contents of STL files. More...
 
class  TorusSDF
 Signed distance field for a torus. More...
 
class  TranslateIF
 Translated implicit function. More...
 
class  Triangle
 Triangle class with signed distance functionality. More...
 
struct  TriangleSoAT
 SoA (Structure of Arrays) layout for W triangles, enabling SIMD evaluation. More...
 
class  TriMeshSDF
 Signed distance function for a pure triangle mesh using SoA-grouped primitives in a compact (linearized) BVH. More...
 
class  UnionIF
 Implicit function whose interior is the union of all input function interiors. More...
 
class  Vec2T
 Two-dimensional vector class with arithmetic operators. More...
 
class  Vec3T
 Three-dimensional vector class with arithmetic operators. More...
 
class  VTK
 Class for storing VTK Polydata meshes. More...
 

Functions

template<class T , class P = ImplicitFunction<T>>
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.
 
template<class T , class P1 , class P2 >
std::shared_ptr< ImplicitFunction< T > > Union (const std::shared_ptr< P1 > &a_implicitFunctionA, const std::shared_ptr< P2 > &a_implicitFunctionB)
 Constructs an implicit function whose interior is the union of the interiors of A and B.
 
template<class T , class P = ImplicitFunction<T>>
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 interiors.
 
template<class T , class P1 , class P2 >
std::shared_ptr< ImplicitFunction< T > > SmoothUnion (const std::shared_ptr< P1 > &a_implicitFunctionA, const std::shared_ptr< P2 > &a_implicitFunctionB, const T a_smooth)
 Constructs an implicit function whose interior is a smoothly blended union of the interiors of A and B.
 
template<class T , class P , class BV , size_t K>
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.
 
template<class T , class P , class BV , size_t K>
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.
 
template<class T , class P >
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 functions.
 
template<class T , class P1 , class P2 >
std::shared_ptr< ImplicitFunction< T > > Intersection (const std::shared_ptr< P1 > &a_implicitFunctionA, const std::shared_ptr< P2 > &a_implicitFunctionB)
 Constructs an implicit function whose interior is the intersection of the interiors of A and B.
 
template<class T , class P >
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 function interiors.
 
template<class T , class P1 , class P2 >
std::shared_ptr< ImplicitFunction< T > > SmoothIntersection (const std::shared_ptr< P1 > &a_implicitFunctionA, const std::shared_ptr< P2 > &a_implicitFunctionB, const T a_smooth)
 Constructs an implicit function whose interior is a smoothly blended intersection of the interiors of A and B.
 
template<class T , class P1 = ImplicitFunction<T>, class P2 = ImplicitFunction<T>>
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.
 
template<class T , class P1 = ImplicitFunction<T>, class P2 = ImplicitFunction<T>>
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.
 
template<class T , class P = ImplicitFunction<T>>
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.
 
template<class T >
std::shared_ptr< ImplicitFunction< T > > Complement (const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction)
 Convenience function for taking the complement of an implicit function.
 
template<class T >
std::shared_ptr< ImplicitFunction< T > > Translate (const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction, const Vec3T< T > &a_shift)
 Convenience function for translating an implicit function.
 
template<class T >
std::shared_ptr< ImplicitFunction< T > > Rotate (const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction, const T a_angle, const size_t a_axis)
 Convenience function for rotating an implicit function.
 
template<class T >
std::shared_ptr< ImplicitFunction< T > > Scale (const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction, const T a_scale)
 Convenience function for scaling an implicit function.
 
template<class T >
std::shared_ptr< ImplicitFunction< T > > Offset (const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction, const T a_offset)
 Convenience function for offsetting an implicit function.
 
template<class T >
std::shared_ptr< ImplicitFunction< T > > Annular (const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction, const T a_delta)
 Convenience function for creating a shell out of an implicit function.
 
template<class T >
std::shared_ptr< ImplicitFunction< T > > Blur (const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction, const T a_blurDistance)
 Convenience function for blurring an implicit function.
 
template<class T >
std::shared_ptr< ImplicitFunction< T > > Mollify (const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction, const T a_dist, const size_t a_mollifierSamples=2)
 Convenience function for mollification with an input sphere.
 
template<class T >
std::shared_ptr< ImplicitFunction< T > > Elongate (const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction, const Vec3T< T > &a_elongation)
 Convenience function for elongating (stretching) an implicit function.
 
template<class T >
std::shared_ptr< ImplicitFunction< T > > Reflect (const std::shared_ptr< ImplicitFunction< T > > &a_implicitFunction, const size_t &a_reflectPlane)
 Convenience function for reflecting an implicit function.
 
template<typename T >
constexpr Vec2T< T > operator* (const T &s, const Vec2T< T > &a_other) noexcept
 Scalar-left multiplication: s * vec.
 
template<typename T >
constexpr Vec2T< T > operator/ (const T &s, const Vec2T< T > &a_other) noexcept
 Component-wise scalar-left division: s / vec.
 
template<typename T >
Vec2T< T > min (const Vec2T< T > &u, const Vec2T< T > &v) noexcept
 Component-wise minimum of two vectors.
 
template<typename T >
Vec2T< T > max (const Vec2T< T > &u, const Vec2T< T > &v) noexcept
 Component-wise maximum of two vectors.
 
template<typename T >
dot (const Vec2T< T > &u, const Vec2T< T > &v) noexcept
 Dot product of two 2D vectors.
 
template<typename T >
length (const Vec2T< T > &v) noexcept
 Euclidean length of a 2D vector.
 
template<class R , typename T >
constexpr Vec3T< T > operator* (const R &s, const Vec3T< T > &u) noexcept
 Scalar-left multiplication: s * vec.
 
template<typename T >
constexpr Vec3T< T > operator* (const Vec3T< T > &u, const Vec3T< T > &v) noexcept
 Component-wise multiplication of two vectors.
 
template<class R , typename T >
constexpr Vec3T< T > operator/ (const R &s, const Vec3T< T > &u) noexcept
 Component-wise scalar-left division: s / vec.
 
template<typename T >
constexpr Vec3T< T > min (const Vec3T< T > &u, const Vec3T< T > &v) noexcept
 Component-wise minimum of two 3D vectors.
 
template<typename T >
constexpr Vec3T< T > max (const Vec3T< T > &u, const Vec3T< T > &v) noexcept
 Component-wise maximum of two 3D vectors.
 
template<typename T >
constexpr Vec3T< T > clamp (const Vec3T< T > &v, const Vec3T< T > &lo, const Vec3T< T > &hi) noexcept
 Component-wise clamp of a 3D vector.
 
template<typename T >
constexprdot (const Vec3T< T > &u, const Vec3T< T > &v) noexcept
 Dot product of two 3D vectors.
 
template<typename T >
constexpr Vec3T< T > cross (const Vec3T< T > &u, const Vec3T< T > &v) noexcept
 Cross product of two 3D vectors.
 
template<typename T >
constexprlength (const Vec3T< T > &v) noexcept
 Euclidean length of a 3D vector.
 

Variables

template<class T >
constexprpi = T(3.14159265358979323846L)
 The mathematical constant π, typed as T.
 
template<class T >
std::function< T(const T &a, const T &b, const T &s)> ExpMin
 Exponential smooth minimum for blending two signed-distance values.
 
template<class T >
std::function< T(const T &a, const T &b, const T &s)> SmoothMin
 Quadratic polynomial smooth minimum for blending two signed-distance values.
 
template<class T >
std::function< T(const T &a, const T &b, const T &s)> SmoothMax
 Quadratic polynomial smooth maximum for blending two signed-distance values.
 

Detailed Description

Namespace containing all of EBGeometry's functionality.

EBGeometry is a header-only C++17 library for implicit functions, signed distance functions, constructive solid geometry (CSG), and DCEL surface meshes. Including EBGeometry.hpp exposes every public class and free function through this namespace.

Function Documentation

◆ Annular()

template<class T >
std::shared_ptr< ImplicitFunction< T > > EBGeometry::Annular ( const std::shared_ptr< ImplicitFunction< T > > &  a_implicitFunction,
const a_delta 
)

Convenience function for creating a shell out of an implicit function.

Template Parameters
TFloating-point precision
Parameters
[in]a_implicitFunctionInput implicit function to be shelled.
[in]a_deltaShell thickness
Returns
New implicit function representing the annular (hollow) version of the input

◆ Blur()

template<class T >
std::shared_ptr< ImplicitFunction< T > > EBGeometry::Blur ( const std::shared_ptr< ImplicitFunction< T > > &  a_implicitFunction,
const a_blurDistance 
)

Convenience function for blurring an implicit function.

Template Parameters
TFloating-point precision
Parameters
[in]a_implicitFunctionInput implicit function to be blurred
[in]a_blurDistanceSmoothing distance
Returns
New implicit function representing the blurred input

◆ BVHSmoothUnion()

template<class T , class P , class BV , size_t K>
std::shared_ptr< ImplicitFunction< T > > EBGeometry::BVHSmoothUnion ( const std::vector< std::shared_ptr< P > > &  a_implicitFunctions,
const std::vector< BV > &  a_boundingVolumes,
const a_smoothLen 
)
noexcept

Constructs a BVH-accelerated smooth union of implicit functions.

Uses the BVH to locate the two nearest primitives and applies a smooth-minimum to their values, yielding C1 (or better) blending across nearby surfaces. Sub-linear query cost.

Template Parameters
TFloating-point precision.
PPrimitive type; must derive from ImplicitFunction<T>.
BVBounding volume type (e.g. AABBT<T>).
KBVH branching factor.
Parameters
[in]a_implicitFunctionsInput implicit functions.
[in]a_boundingVolumesBounding volumes for each implicit function.
[in]a_smoothLenSmoothing length (must be > 0).
Returns
Shared pointer to a BVHSmoothUnionIF<T,P,BV,K> with an internal BVH.

◆ BVHUnion()

template<class T , class P , class BV , size_t K>
std::shared_ptr< ImplicitFunction< T > > EBGeometry::BVHUnion ( const std::vector< std::shared_ptr< P > > &  a_implicitFunctions,
const std::vector< BV > &  a_boundingVolumes 
)

Constructs a BVH-accelerated union of implicit functions.

Wraps a PackedBVH over the inputs; at query time the BVH culls primitives whose bounding volume is further than the current best distance, giving sub-linear cost on large scenes. Interior semantics are identical to UnionIF.

Template Parameters
TFloating-point precision.
PPrimitive type; must derive from ImplicitFunction<T>.
BVBounding volume type (e.g. AABBT<T>).
KBVH branching factor.
Parameters
[in]a_implicitFunctionsInput implicit functions.
[in]a_boundingVolumesBounding volumes for each implicit function.
Returns
Shared pointer to a BVHUnionIF<T,P,BV,K> with an internal BVH.

◆ clamp()

template<typename T >
constexpr Vec3T< T > EBGeometry::clamp ( const Vec3T< T > &  v,
const Vec3T< T > &  lo,
const Vec3T< T > &  hi 
)
inlineconstexprnoexcept

Component-wise clamp of a 3D vector.

Template Parameters
TFloating-point precision.
Parameters
[in]vVector to be clamped.
[in]loComponent-wise lower bound.
[in]hiComponent-wise upper bound.
Returns
New vector with X[i] = std::clamp(v[i], lo[i], hi[i]).

◆ Complement()

template<class T >
std::shared_ptr< ImplicitFunction< T > > EBGeometry::Complement ( const std::shared_ptr< ImplicitFunction< T > > &  a_implicitFunction)

Convenience function for taking the complement of an implicit function.

Template Parameters
TFloating-point precision
Parameters
[in]a_implicitFunctionInput implicit function
Returns
New implicit function representing the complement (negated value)

◆ cross()

template<typename T >
constexpr Vec3T< T > EBGeometry::cross ( const Vec3T< T > &  u,
const Vec3T< T > &  v 
)
inlineconstexprnoexcept

Cross product of two 3D vectors.

Template Parameters
TFloating-point precision.
Parameters
[in]uFirst vector.
[in]vSecond vector.
Returns
Cross product u × v.

◆ Difference()

template<class T , class P1 = ImplicitFunction<T>, class P2 = ImplicitFunction<T>>
std::shared_ptr< ImplicitFunction< T > > EBGeometry::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.

A point is inside the result if and only if it is inside A and outside B.

Template Parameters
TFloating-point precision.
P1Type of the minuend A; must derive from ImplicitFunction<T>.
P2Type of the subtrahend B; must derive from ImplicitFunction<T>.
Parameters
[in]a_implicitFunctionAMinuend implicit function.
[in]a_implicitFunctionBSubtrahend implicit function.
Returns
Shared pointer to a DifferenceIF<T> representing A \ B.

◆ dot() [1/2]

template<typename T >
T EBGeometry::dot ( const Vec2T< T > &  u,
const Vec2T< T > &  v 
)
inlinenoexcept

Dot product of two 2D vectors.

Template Parameters
TFloating-point precision.
Parameters
[in]uFirst vector.
[in]vSecond vector.
Returns
Scalar dot product u · v.

◆ dot() [2/2]

template<typename T >
constexpr T EBGeometry::dot ( const Vec3T< T > &  u,
const Vec3T< T > &  v 
)
inlineconstexprnoexcept

Dot product of two 3D vectors.

Template Parameters
TFloating-point precision.
Parameters
[in]uFirst vector.
[in]vSecond vector.
Returns
Scalar dot product u · v.

◆ Elongate()

template<class T >
std::shared_ptr< ImplicitFunction< T > > EBGeometry::Elongate ( const std::shared_ptr< ImplicitFunction< T > > &  a_implicitFunction,
const Vec3T< T > &  a_elongation 
)

Convenience function for elongating (stretching) an implicit function.

Template Parameters
TFloating-point precision
Parameters
[in]a_implicitFunctionImplicit function to be elongated
[in]a_elongationPer-axis elongation amounts
Returns
New implicit function representing the stretched input

◆ FiniteRepetition()

template<class T , class P = ImplicitFunction<T>>
std::shared_ptr< ImplicitFunction< T > > EBGeometry::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.

The query point is folded into the nearest cell before evaluating the base function. The repetition count is clamped to [a_repeatLo, a_repeatHi] per axis; outside this range the nearest tile is evaluated.

Template Parameters
TFloating-point precision.
PPrimitive type; must derive from ImplicitFunction<T>.
Parameters
[in]a_implicitFunctionBase implicit function to tile.
[in]a_periodTile period in each coordinate direction (all components must be > 0).
[in]a_repeatLoRepetition count for decreasing coordinates (integer values).
[in]a_repeatHiRepetition count for increasing coordinates (integer values).
Returns
Shared pointer to a FiniteRepetitionIF<T>.

◆ Intersection() [1/2]

template<class T , class P1 , class P2 >
std::shared_ptr< ImplicitFunction< T > > EBGeometry::Intersection ( const std::shared_ptr< P1 > &  a_implicitFunctionA,
const std::shared_ptr< P2 > &  a_implicitFunctionB 
)

Constructs an implicit function whose interior is the intersection of the interiors of A and B.

Template Parameters
TFloating-point precision.
P1Type of A; must derive from ImplicitFunction<T>.
P2Type of B; must derive from ImplicitFunction<T>.
Parameters
[in]a_implicitFunctionAFirst implicit function.
[in]a_implicitFunctionBSecond implicit function.
Returns
Shared pointer to an IntersectionIF<T> containing both functions.

◆ Intersection() [2/2]

template<class T , class P >
std::shared_ptr< ImplicitFunction< T > > EBGeometry::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 functions.

The returned object evaluates to the maximum over all input functions at any query point.

Template Parameters
TFloating-point precision.
PPrimitive type; must derive from ImplicitFunction<T>.
Parameters
[in]a_implicitFunctionsInput implicit functions.
Returns
Shared pointer to an IntersectionIF<T> wrapping all input functions.

◆ length() [1/2]

template<typename T >
T EBGeometry::length ( const Vec2T< T > &  v)
inlinenoexcept

Euclidean length of a 2D vector.

Template Parameters
TFloating-point precision.
Parameters
[in]vVector.
Returns
std::sqrt(v.x*v.x + v.y*v.y).

◆ length() [2/2]

template<typename T >
constexpr T EBGeometry::length ( const Vec3T< T > &  v)
inlineconstexprnoexcept

Euclidean length of a 3D vector.

Template Parameters
TFloating-point precision.
Parameters
[in]vVector.
Returns
std::sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]).

◆ max() [1/2]

template<typename T >
Vec2T< T > EBGeometry::max ( const Vec2T< T > &  u,
const Vec2T< T > &  v 
)
inlinenoexcept

Component-wise maximum of two vectors.

Template Parameters
TFloating-point precision.
Parameters
[in]uFirst vector.
[in]vSecond vector.
Returns
New vector with x = std::max(u.x, v.x), y = std::max(u.y, v.y).

◆ max() [2/2]

template<typename T >
constexpr Vec3T< T > EBGeometry::max ( const Vec3T< T > &  u,
const Vec3T< T > &  v 
)
inlineconstexprnoexcept

Component-wise maximum of two 3D vectors.

Template Parameters
TFloating-point precision.
Parameters
[in]uFirst vector.
[in]vSecond vector.
Returns
New vector with X[i] = std::max(u[i], v[i]).

◆ min() [1/2]

template<typename T >
Vec2T< T > EBGeometry::min ( const Vec2T< T > &  u,
const Vec2T< T > &  v 
)
inlinenoexcept

Component-wise minimum of two vectors.

Template Parameters
TFloating-point precision.
Parameters
[in]uFirst vector.
[in]vSecond vector.
Returns
New vector with x = std::min(u.x, v.x), y = std::min(u.y, v.y).

◆ min() [2/2]

template<typename T >
constexpr Vec3T< T > EBGeometry::min ( const Vec3T< T > &  u,
const Vec3T< T > &  v 
)
inlineconstexprnoexcept

Component-wise minimum of two 3D vectors.

Template Parameters
TFloating-point precision.
Parameters
[in]uFirst vector.
[in]vSecond vector.
Returns
New vector with X[i] = std::min(u[i], v[i]).

◆ Mollify()

template<class T >
std::shared_ptr< ImplicitFunction< T > > EBGeometry::Mollify ( const std::shared_ptr< ImplicitFunction< T > > &  a_implicitFunction,
const a_dist,
const size_t  a_mollifierSamples = 2 
)

Convenience function for mollification with an input sphere.

Template Parameters
TFloating-point precision
Parameters
[in]a_implicitFunctionInput implicit function to be mollified
[in]a_distMollification distance.
[in]a_mollifierSamplesNumber of samples per dimension for the convolution kernel (must be >= 1).
Returns
New implicit function representing the mollified (smoothed) input

◆ Offset()

template<class T >
std::shared_ptr< ImplicitFunction< T > > EBGeometry::Offset ( const std::shared_ptr< ImplicitFunction< T > > &  a_implicitFunction,
const a_offset 
)

Convenience function for offsetting an implicit function.

Template Parameters
TFloating-point precision
Parameters
[in]a_implicitFunctionInput implicit function to be offset
[in]a_offsetOffset distance subtracted from the function value
Returns
New implicit function representing the offset (grown/shrunk) input

◆ operator*() [1/3]

template<class R , typename T >
constexpr Vec3T< T > EBGeometry::operator* ( const R s,
const Vec3T< T > &  u 
)
inlineconstexprnoexcept

Scalar-left multiplication: s * vec.

Template Parameters
RType of scalar (may differ from T, e.g. int * Vec3T<double>).
TFloating-point precision of the vector.
Parameters
[in]sScalar multiplier.
[in]uVector.
Returns
New vector with X[i] = s * u[i].

◆ operator*() [2/3]

template<typename T >
constexpr Vec2T< T > EBGeometry::operator* ( const T &  s,
const Vec2T< T > &  a_other 
)
inlineconstexprnoexcept

Scalar-left multiplication: s * vec.

Template Parameters
TFloating-point precision.
Parameters
[in]sScalar multiplier.
[in]a_otherVector.
Returns
New vector with x = s*a_other.x, y = s*a_other.y.

◆ operator*() [3/3]

template<typename T >
constexpr Vec3T< T > EBGeometry::operator* ( const Vec3T< T > &  u,
const Vec3T< T > &  v 
)
inlineconstexprnoexcept

Component-wise multiplication of two vectors.

Template Parameters
TFloating-point precision.
Parameters
[in]uFirst vector.
[in]vSecond vector.
Returns
New vector with X[i] = u[i] * v[i].

◆ operator/() [1/2]

template<class R , typename T >
constexpr Vec3T< T > EBGeometry::operator/ ( const R s,
const Vec3T< T > &  u 
)
inlineconstexprnoexcept

Component-wise scalar-left division: s / vec.

Returns a new vector where each component i is s / u[i].

Template Parameters
RType of scalar numerator.
TFloating-point precision of the vector.
Parameters
[in]sScalar numerator.
[in]uVector whose components are the denominators.
Returns
New vector with X[i] = s / u[i].

◆ operator/() [2/2]

template<typename T >
constexpr Vec2T< T > EBGeometry::operator/ ( const T &  s,
const Vec2T< T > &  a_other 
)
inlineconstexprnoexcept

Component-wise scalar-left division: s / vec.

Returns a new vector where each component i is s / a_other[i].

Template Parameters
TFloating-point precision.
Parameters
[in]sScalar numerator.
[in]a_otherVector whose components are the denominators.
Returns
New vector with x = s/a_other.x, y = s/a_other.y.

◆ Reflect()

template<class T >
std::shared_ptr< ImplicitFunction< T > > EBGeometry::Reflect ( const std::shared_ptr< ImplicitFunction< T > > &  a_implicitFunction,
const size_t a_reflectPlane 
)

Convenience function for reflecting an implicit function.

Template Parameters
TFloating-point precision
Parameters
[in]a_implicitFunctionImplicit function to be reflected
[in]a_reflectPlanePlane to reflect across (0=yz-plane, 1=xz-plane, 2=xy-plane).
Returns
New implicit function representing the reflected input

◆ Rotate()

template<class T >
std::shared_ptr< ImplicitFunction< T > > EBGeometry::Rotate ( const std::shared_ptr< ImplicitFunction< T > > &  a_implicitFunction,
const a_angle,
const size_t  a_axis 
)

Convenience function for rotating an implicit function.

Template Parameters
TFloating-point precision
Parameters
[in]a_implicitFunctionInput implicit function to be rotated.
[in]a_angleAngle to be rotated by (in degrees)
[in]a_axisAxis to rotate about (0=x, 1=y, 2=z)
Returns
New implicit function representing the rotated input

◆ Scale()

template<class T >
std::shared_ptr< ImplicitFunction< T > > EBGeometry::Scale ( const std::shared_ptr< ImplicitFunction< T > > &  a_implicitFunction,
const a_scale 
)

Convenience function for scaling an implicit function.

Template Parameters
TFloating-point precision
Parameters
[in]a_implicitFunctionInput implicit function to be scaled.
[in]a_scaleScaling factor (must be non-zero)
Returns
New implicit function representing the uniformly scaled input

◆ SmoothDifference()

template<class T , class P1 = ImplicitFunction<T>, class P2 = ImplicitFunction<T>>
std::shared_ptr< ImplicitFunction< T > > EBGeometry::SmoothDifference ( const std::shared_ptr< P1 > &  a_implicitFunctionA,
const std::shared_ptr< P2 > &  a_implicitFunctionB,
const a_smoothLen 
)

Constructs an implicit function representing a smoothly blended set difference A \ B.

Implemented as a smooth intersection of A with the complement of B.

Template Parameters
TFloating-point precision.
P1Type of the minuend A; must derive from ImplicitFunction<T>.
P2Type of the subtrahend B; must derive from ImplicitFunction<T>.
Parameters
[in]a_implicitFunctionAMinuend implicit function.
[in]a_implicitFunctionBSubtrahend implicit function.
[in]a_smoothLenSmoothing length (must be > 0).
Returns
Shared pointer to a SmoothDifferenceIF<T> representing the smooth A \ B.

◆ SmoothIntersection() [1/2]

template<class T , class P1 , class P2 >
std::shared_ptr< ImplicitFunction< T > > EBGeometry::SmoothIntersection ( const std::shared_ptr< P1 > &  a_implicitFunctionA,
const std::shared_ptr< P2 > &  a_implicitFunctionB,
const a_smooth 
)

Constructs an implicit function whose interior is a smoothly blended intersection of the interiors of A and B.

Template Parameters
TFloating-point precision.
P1Type of A; must derive from ImplicitFunction<T>.
P2Type of B; must derive from ImplicitFunction<T>.
Parameters
[in]a_implicitFunctionAFirst implicit function.
[in]a_implicitFunctionBSecond implicit function.
[in]a_smoothSmoothing length (must be > 0).
Returns
Shared pointer to a SmoothIntersectionIF<T> containing both functions.

◆ SmoothIntersection() [2/2]

template<class T , class P >
std::shared_ptr< ImplicitFunction< T > > EBGeometry::SmoothIntersection ( const std::vector< std::shared_ptr< P > > &  a_implicitFunctions,
const a_smooth 
)

Constructs an implicit function whose interior is a smoothly blended intersection of all input function interiors.

Template Parameters
TFloating-point precision.
PPrimitive type; must derive from ImplicitFunction<T>.
Parameters
[in]a_implicitFunctionsInput implicit functions.
[in]a_smoothSmoothing length (must be > 0).
Returns
Shared pointer to a SmoothIntersectionIF<T> wrapping all input functions.

◆ SmoothUnion() [1/2]

template<class T , class P1 , class P2 >
std::shared_ptr< ImplicitFunction< T > > EBGeometry::SmoothUnion ( const std::shared_ptr< P1 > &  a_implicitFunctionA,
const std::shared_ptr< P2 > &  a_implicitFunctionB,
const a_smooth 
)

Constructs an implicit function whose interior is a smoothly blended union of the interiors of A and B.

Template Parameters
TFloating-point precision.
P1Type of A; must derive from ImplicitFunction<T>.
P2Type of B; must derive from ImplicitFunction<T>.
Parameters
[in]a_implicitFunctionAFirst implicit function.
[in]a_implicitFunctionBSecond implicit function.
[in]a_smoothSmoothing length (must be > 0).
Returns
Shared pointer to a SmoothUnionIF<T> containing both functions.

◆ SmoothUnion() [2/2]

template<class T , class P = ImplicitFunction<T>>
std::shared_ptr< ImplicitFunction< T > > EBGeometry::SmoothUnion ( const std::vector< std::shared_ptr< P > > &  a_implicitFunctions,
const a_smooth 
)

Constructs an implicit function whose interior is a smoothly blended union of all input function interiors.

Uses SmoothMin to blend the two closest values; the blend region width is a_smooth.

Template Parameters
TFloating-point precision.
PPrimitive type; must derive from ImplicitFunction<T>.
Parameters
[in]a_implicitFunctionsInput implicit functions.
[in]a_smoothSmoothing length (must be > 0).
Returns
Shared pointer to a SmoothUnionIF<T> wrapping all input functions.

◆ Translate()

template<class T >
std::shared_ptr< ImplicitFunction< T > > EBGeometry::Translate ( const std::shared_ptr< ImplicitFunction< T > > &  a_implicitFunction,
const Vec3T< T > &  a_shift 
)

Convenience function for translating an implicit function.

Template Parameters
TFloating-point precision
Parameters
[in]a_implicitFunctionInput implicit function to be translated
[in]a_shiftDistance to shift
Returns
New implicit function representing the translated input

◆ Union() [1/2]

template<class T , class P1 , class P2 >
std::shared_ptr< ImplicitFunction< T > > EBGeometry::Union ( const std::shared_ptr< P1 > &  a_implicitFunctionA,
const std::shared_ptr< P2 > &  a_implicitFunctionB 
)

Constructs an implicit function whose interior is the union of the interiors of A and B.

Template Parameters
TFloating-point precision.
P1Type of A; must derive from ImplicitFunction<T>.
P2Type of B; must derive from ImplicitFunction<T>.
Parameters
[in]a_implicitFunctionAFirst implicit function.
[in]a_implicitFunctionBSecond implicit function.
Returns
Shared pointer to a UnionIF<T> containing both functions.

◆ Union() [2/2]

template<class T , class P = ImplicitFunction<T>>
std::shared_ptr< ImplicitFunction< T > > EBGeometry::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.

The returned object evaluates to the minimum over all input functions at any query point.

Template Parameters
TFloating-point precision.
PPrimitive type; must derive from ImplicitFunction<T>.
Parameters
[in]a_implicitFunctionsInput implicit functions.
Returns
Shared pointer to a UnionIF<T> wrapping all input functions.

Variable Documentation

◆ ExpMin

template<class T >
std::function<T(const T& a, const T& b, const T& s)> EBGeometry::ExpMin
Initial value:
= [](const T& a, const T& b, const T& s) -> T {
static_assert(std::is_floating_point_v<T>, "ExpMin requires a floating-point type T");
EBGEOMETRY_EXPECT(s > T(0));
T ret = std::exp(-a / s) + std::exp(-b / s);
return -std::log(ret) * s;
}
#define EBGEOMETRY_EXPECT(cond)
Runtime precondition assertion for EBGeometry.
Definition EBGeometry_Macros.hpp:62

Exponential smooth minimum for blending two signed-distance values.

Approximates min(a, b) with exponential weighting; the blend region width scales with s. Useful when a differentiable interface is required. Approaches min(a, b) as s → 0.

Template Parameters
TFloating-point precision.
Parameters
[in]aFirst value.
[in]bSecond value.
[in]sSmoothing length (must be > 0).
Returns
Exponentially blended approximation of min(a, b).

◆ pi

template<class T >
constexpr T EBGeometry::pi = T(3.14159265358979323846L)
inlineconstexpr

The mathematical constant π, typed as T.

Defined to 20 significant digits, which covers the full precision of both float (7 significant digits) and long double (18–21 significant digits).

Template Parameters
TFloating-point type.

◆ SmoothMax

template<class T >
std::function<T(const T& a, const T& b, const T& s)> EBGeometry::SmoothMax
Initial value:
= [](const T& a, const T& b, const T& s) -> T {
static_assert(std::is_floating_point_v<T>, "SmoothMax requires a floating-point type T");
EBGEOMETRY_EXPECT(s > T(0));
const T h = std::max(s - std::abs(a - b), T(0)) / s;
return std::max(a, b) + T(0.25) * h * h * s;
}

Quadratic polynomial smooth maximum for blending two signed-distance values.

Approximates max(a, b) within the overlap region |a - b| < s; coincides exactly with max(a, b) outside that region. Symmetric counterpart to SmoothMin; used for CSG intersections and differences.

Template Parameters
TFloating-point precision.
Parameters
[in]aFirst value.
[in]bSecond value.
[in]sSmoothing length (must be > 0). Controls the blend region width.
Returns
Polynomial-blended approximation of max(a, b).

◆ SmoothMin

template<class T >
std::function<T(const T& a, const T& b, const T& s)> EBGeometry::SmoothMin
Initial value:
= [](const T& a, const T& b, const T& s) -> T {
static_assert(std::is_floating_point_v<T>, "SmoothMin requires a floating-point type T");
EBGEOMETRY_EXPECT(s > T(0));
const T h = std::max(s - std::abs(a - b), T(0)) / s;
return std::min(a, b) - T(0.25) * h * h * s;
}

Quadratic polynomial smooth minimum for blending two signed-distance values.

Approximates min(a, b) within the overlap region |a - b| < s; coincides exactly with min(a, b) outside that region. Cheaper to evaluate than ExpMin and the default choice for CSG unions.

Template Parameters
TFloating-point precision.
Parameters
[in]aFirst value.
[in]bSecond value.
[in]sSmoothing length (must be > 0). Controls the blend region width.
Returns
Polynomial-blended approximation of min(a, b).