EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | 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  CSGDetail
 Internal helpers shared by BVHUnion and BVHSmoothUnion.
 
namespace  CSGOps
 The arithmetic of each CSG operation, shared by the Tape and the fused operations.
 
namespace  DCEL
 Namespace containing various double-connected edge list (DCEL) functionality.
 
namespace  Fused
 Fused CSG: the expression builder's operations as types (see EBGeometry_Fused.hpp).
 
namespace  GPU
 Backend-neutral GPU runtime API surface (CUDA or HIP).
 
namespace  Math
 Scalar helpers and numeric limits usable in host and device code.
 
namespace  Parser
 Namespace which encapsulates possible file parsers for building EBGeometry data structures.
 
namespace  PointCloud
 Query results and helpers shared by PointCloudBVH and PointCloudHashGrid.
 
namespace  PointCloudDetail
 Internal helpers shared by the point-cloud search structures; not part of the public API.
 
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  SIMD
 SIMD register wrappers and the scalar operations that mirror them.
 
namespace  Soup
 Namespace containing basic functionality for turning planar-polygon soups into DCEL meshes.
 
namespace  TapeFeature
 Optional tape features, listed among a Tape's template arguments: Tape<T, TapeFeature::ExactOffsets>.
 
namespace  TriangleDistance
 The triangle signed-distance kernel.
 
namespace  TriangleRay
 The triangle ray-crossing kernel.
 
namespace  TriangleSoA
 Namespace for TriangleSoAT-related compile-time utilities.
 

Classes

struct  Affine3T
 An affine map of 3D space, x -> A x + b, with A stored by rows. More...
 
struct  Array
 Fixed-size array with host- and device-callable members. More...
 
class  BoxSDF
 Signed distance field for an axis-aligned box (AABB). More...
 
class  BVHSmoothUnion
 BVH-accelerated smooth union of many primitives of one type. More...
 
class  BVHUnion
 BVH-accelerated union of many primitives of one type. More...
 
class  CapsuleSDF
 Signed distance field for a capsule (pill shape): a cylinder capped with hemispheres. More...
 
struct  ClosestFace
 The face of a mesh closest to a query point, as the mesh SDFs' getClosestFace() returns it. More...
 
class  ConeSDF
 Signed distance field for a finite cone. More...
 
class  CylinderSDF
 Signed distance field for a finite, flat-capped cylinder. More...
 
class  DeviceMemoryResource
 Device memory resource: raw device allocation (GPU::memAlloc / GPU::memFree). More...
 
struct  DistanceQualityOf
 The distance quality of a type: its static distanceQuality member if it has one, and DistanceQuality::Bound otherwise. More...
 
struct  DistanceQualityOf< P, std::void_t< decltype(P::distanceQuality)> >
 The distance quality of a type that declares one. More...
 
class  EmulatedDeviceMemoryResource
 Host memory that stands in for device memory: host RAM that reports itself device-accessible. More...
 
struct  ExpMaxOp
 Exponential smooth maximum for blending two signed-distance values. More...
 
struct  ExpMinOp
 Exponential smooth minimum for blending two signed-distance values. More...
 
class  Expr
 A composed object: an immutable tree of shapes and operations, built on the host and compiled by a Tape. More...
 
class  FlatMeshSDF
 Signed distance function for a DCEL mesh. Does not use BVHs. More...
 
struct  HitT
 Where a ray first crosses a surface. More...
 
class  HostMemoryResource
 Host memory resource: plain aligned allocation in host RAM (std::aligned_alloc / free family). More...
 
class  InfiniteConeSDF
 Signed distance field for an infinite cone. More...
 
class  InfiniteCylinderSDF
 Signed distance field for an infinitely long cylinder. More...
 
class  ManagedMemoryResource
 Managed (unified) memory resource: one allocation reachable from host and device (GPU::memAllocManaged / GPU::memFree). More...
 
class  MappedMemoryResource
 Mapped (zero-copy) pinned host memory resource: page-locked host memory also mapped into the device address space (GPU::memAllocHostMapped / GPU::memFreeHost). More...
 
class  MemoryResource
 Abstract placement policy: allocates and frees raw, correctly-aligned byte blocks. More...
 
class  MeshSDF
 A FlatMeshSDF must be trivially copyable: that is what lets a rebasedView() be byte-copied into a device address space with no pointer patching. More...
 
class  PerlinSDF
 Ken Perlin's gradient-noise implicit function. More...
 
class  PinnedMemoryResource
 Pinned (page-locked) host memory resource: fast host-to-device staging (GPU::memAllocHost / GPU::memFreeHost). More...
 
class  PlaneSDF
 Signed distance function for a plane. More...
 
struct  PODSpan
 Raw pointer + size view into a Pool block, for hot inner loops. More...
 
struct  PODVector
 Placement-independent descriptor of a POD array inside a Pool. More...
 
struct  PointAoSoA
 A PointSoAT<T, W> group that also carries each point's cloud index. More...
 
class  PointCloudBVH
 A BVH over a point cloud, 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  PolygonSoup
 Polygons as a file stores them: vertex coordinates, faces as lists of vertex indices, and named per-vertex and per-face scalar properties. More...
 
class  Pool
 Growable bump arena over a MemoryResource. More...
 
struct  PoolControl
 Stable, heap-resident handle to a Pool's current base address and identity. More...
 
class  PoolHandle
 Base of every pool-resident handle: the one PoolLocation its arrays resolve against. More...
 
struct  PoolLocation
 Where a pool-resident descriptor resolves its offsets, and the rules for moving it. More...
 
struct  PrimitiveRef
 The deciding leaf of a composition at a point: the primitive whose surface the composed value comes from there, as Tape::closestPrimitive() reports it. More...
 
struct  RayForm
 How to ray trace a shape directly, instead of marching its signed distance. More...
 
struct  RayForm< BoxSDF< T > >
 BoxSDF's ray form: the slab test, axis by axis. Exact, and callable on a device. More...
 
struct  RayForm< BVHUnion< T, P, K > >
 BVHUnion's ray form: the union of the spans of the primitives whose boxes the ray meets, found by walking the BVH nearest box first and leaving out the boxes beyond what the union so far is known up to. Exact where the primitive type has a ray form (and marched one primitive at a time otherwise), and callable on a device. More...
 
struct  RayForm< CapsuleSDF< T > >
 CapsuleSDF's ray form: the span of the cylinder between its centers and of the two balls at its ends, which, the capsule being convex, is one interval. Exact, and callable on a device. More...
 
struct  RayForm< CylinderSDF< T > >
 CylinderSDF's ray form: the infinite cylinder around its axis, clipped by the slab between its caps. Exact, and callable on a device. More...
 
struct  RayForm< FlatMeshSDF< T > >
 FlatMeshSDF's ray form: every face tested, as FlatMeshSDF's signed distance tests every face (no BVH). Exact, and callable on a device; as for MeshSDF otherwise. More...
 
struct  RayForm< Fused::Node< Fused::ShiftOp< T, IsAnnulus >, C >, std::enable_if_t< RayDetail::HasLevelForm< C >::value > >
 The ray form of a fused offset or annulus of a shape whose level sets have a closed form (see RayDetail::LevelForm): traced through its level view. More...
 
struct  RayForm< Fused::Node< Op, Cs... >, std::enable_if_t< Fused::Detail::TracedExactly< Op >::value > >
 The ray form of a fused union, intersection, difference (an intersection with a complement), complement or affine map: its operands' spans, combined. Exact where every leaf has a ray form, and callable on a device. More...
 
struct  RayForm< InfiniteCylinderSDF< T > >
 InfiniteCylinderSDF's ray form: the roots of a quadratic, in the plane across its axis. Exact, and callable on a device. More...
 
struct  RayForm< MeshSDF< T, K > >
 MeshSDF's ray form: the nearest polygon face the ray crosses, found by walking the BVH nearest box first and stopping at boxes farther than the nearest crossing so far. Exact, and callable on a device. More...
 
struct  RayForm< PlaneSDF< T > >
 PlaneSDF's ray form: the crossing of the plane, where the ray goes from one side to the other. Exact, and callable on a device. More...
 
struct  RayForm< RayDetail::LevelView< S >, std::enable_if_t< RayDetail::HasLevelForm< S >::value > >
 The ray form of a level view (RayDetail::LevelView): an offset or an annulus of a shape traced from its closed-form level sets, exactly and callable on a device. More...
 
struct  RayForm< SphereSDF< T > >
 SphereSDF's ray form: the roots of a quadratic. Exact, and callable on a device. More...
 
struct  RayForm< Tape< T, UserPrimitives... > >
 Tape's ray form: the tape traced along its ray program (see Tape::firstHit()). Callable on a device. More...
 
struct  RayForm< TriMeshSDF< T, K, W > >
 TriMeshSDF's ray form: the nearest triangle the ray crosses, found by walking the BVH nearest box first and stopping at boxes farther than the nearest crossing so far. Exact, and callable on a device. More...
 
struct  RayOptions
 How a query marches, where a shape has no ray form. More...
 
struct  RaySpansT
 Where a ray is inside an object over an interval [t0, t1]: its spans, in order, each from where it enters to where it leaves, complete up to a horizon. More...
 
struct  RayT
 A ray: the points origin + t * direction. More...
 
class  RoundedBoxSDF
 Signed distance field for an axis-aligned box with rounded edges and corners. More...
 
class  RoundedCylinderSDF
 Signed distance field for a cylinder with rounded (toroidal) edges. More...
 
class  SimpleTimer
 Simple timer class used for local performance profiling. More...
 
struct  SmoothMaxOp
 Quadratic polynomial smooth maximum for blending two signed-distance values. More...
 
struct  SmoothMinOp
 Quadratic polynomial smooth minimum for blending two signed-distance values. More...
 
struct  SpanEndT
 One end of a span: where a ray enters or leaves an object. More...
 
class  SphereSDF
 Signed distance field for a sphere. More...
 
class  Tape
 A composed object compiled into a pool: a trivially copyable handle that evaluates the object's signed distance (or implicit function value) on the host or on a device. More...
 
struct  TapeOptions
 Settings for compiling an Expr into a Tape. More...
 
class  TorusSDF
 Signed distance field for a torus. More...
 
class  Triangle
 Triangle class with signed distance functionality. More...
 
struct  TriangleAoSoA
 Face-id-carrying wrapper around a single TriangleSoAT<T, W>. 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  Vec2T
 Two-dimensional vector class with arithmetic operators. More...
 
class  Vec3T
 Three-dimensional vector class with arithmetic operators. More...
 

Typedefs

template<class S >
using ShapePrecision = typename ExprDetail::ShapeInfo< S >::precision
 The precision of a shape type: T for a shape whose box type is AABBT<T>.
 
template<class A >
using ExprPrecision = typename ExprDetail::ExprLike< A >::type
 The precision of an expression-like type: T for Expr<T> or for a shape of precision T. Not defined for other types, so a function taking it drops out of overload resolution.
 

Enumerations

enum class  DistanceQuality { Exact , Bound , NotADistance }
 How far the value of a signed distance function can be trusted, from strongest to weakest. More...
 
enum class  BlendKind : uint8_t { Polynomial , Exponential }
 How a smooth union, intersection or difference blends the two extreme values. More...
 
enum class  HitStatus : uint8_t { Miss , Hit , Unresolved }
 The outcome of a ray query. More...
 

Functions

template<class A >
Expr< ExprPrecision< A > > toExpr (const A &a_operand)
 Convert a shape or an Expr to an Expr.
 
template<class A , class B >
Expr< ExprPrecision< A > > Union (const A &a_first, const B &a_second)
 Union of two objects: the minimum of their values.
 
template<class A >
Expr< ExprPrecision< A > > Union (const std::vector< A > &a_operands)
 Union of any number of objects: the minimum of their values.
 
template<class A , class B >
Expr< ExprPrecision< A > > SmoothUnion (const A &a_first, const B &a_second, const ExprPrecision< A > a_smooth, const BlendKind a_blend=BlendKind::Polynomial)
 Smooth union of two objects: a smooth minimum of their values.
 
template<class A >
Expr< ExprPrecision< A > > SmoothUnion (const std::vector< A > &a_operands, const ExprPrecision< A > a_smooth, const BlendKind a_blend=BlendKind::Polynomial)
 Smooth union of any number of objects: a smooth minimum of the two smallest values.
 
template<class A , class B >
Expr< ExprPrecision< A > > Intersection (const A &a_first, const B &a_second)
 Intersection of two objects: the maximum of their values.
 
template<class A >
Expr< ExprPrecision< A > > Intersection (const std::vector< A > &a_operands)
 Intersection of any number of objects: the maximum of their values.
 
template<class A , class B >
Expr< ExprPrecision< A > > SmoothIntersection (const A &a_first, const B &a_second, const ExprPrecision< A > a_smooth, const BlendKind a_blend=BlendKind::Polynomial)
 Smooth intersection of two objects: a smooth maximum of their values.
 
template<class A >
Expr< ExprPrecision< A > > SmoothIntersection (const std::vector< A > &a_operands, const ExprPrecision< A > a_smooth, const BlendKind a_blend=BlendKind::Polynomial)
 Smooth intersection of any number of objects: a smooth maximum of the two largest values.
 
template<class A , class B >
Expr< ExprPrecision< A > > Difference (const A &a_first, const B &a_second)
 Difference A \ B: max(A, -B), inside A and outside B.
 
template<class A , class B >
Expr< ExprPrecision< A > > Difference (const A &a_first, const std::vector< B > &a_others)
 Difference A \ (B1 u B2 u ...): max(A, -min_i Bi).
 
template<class A , class B >
Expr< ExprPrecision< A > > SmoothDifference (const A &a_first, const B &a_second, const ExprPrecision< A > a_smooth, const BlendKind a_blend=BlendKind::Polynomial)
 Smooth difference A \ B: the smooth intersection of A and the complement of B.
 
template<class A , class B >
Expr< ExprPrecision< A > > SmoothDifference (const A &a_first, const std::vector< B > &a_others, const ExprPrecision< A > a_smooth, const BlendKind a_blend=BlendKind::Polynomial)
 Smooth difference A \ (B1, B2, ...): the smooth intersection of A and the complement of each Bi.
 
template<class A >
Expr< ExprPrecision< A > > FiniteRepetition (const A &a_operand, const Vec3T< ExprPrecision< A > > &a_period, const Vec3T< ExprPrecision< A > > &a_repeatLo, const Vec3T< ExprPrecision< A > > &a_repeatHi)
 Finite repetition: copies of an object on a grid of tiles, a_repeatLo tiles below and a_repeatHi tiles above the home tile along each axis.
 
template<class A >
Expr< ExprPrecision< A > > Complement (const A &a_operand)
 Complement: inside and outside swapped, -v.
 
template<class A >
Expr< ExprPrecision< A > > Translate (const A &a_operand, const Vec3T< ExprPrecision< A > > &a_shift)
 Translate an object by a shift.
 
template<class A >
Expr< ExprPrecision< A > > Rotate (const A &a_operand, const ExprPrecision< A > a_degrees, const size_t a_axis)
 Rotate an object about a coordinate axis through the origin.
 
template<class A >
Expr< ExprPrecision< A > > Rotate (const A &a_operand, const ExprPrecision< A > a_degrees, const Vec3T< ExprPrecision< A > > &a_axis)
 Rotate an object about an arbitrary axis through the origin.
 
template<class A >
Expr< ExprPrecision< A > > Scale (const A &a_operand, const ExprPrecision< A > a_factor)
 Scale an object uniformly about the origin.
 
template<class A >
Expr< ExprPrecision< A > > Reflect (const A &a_operand, const size_t a_axis)
 Reflect an object in a coordinate plane through the origin.
 
template<class A >
Expr< ExprPrecision< A > > Offset (const A &a_operand, const ExprPrecision< A > a_offset)
 Offset an object's surface outward by a distance, v - r.
 
template<class A >
Expr< ExprPrecision< A > > Annular (const A &a_operand, const ExprPrecision< A > a_delta)
 A shell around an object's surface, |v| - delta.
 
template<class A >
Expr< ExprPrecision< A > > Elongate (const A &a_operand, const Vec3T< ExprPrecision< A > > &a_elongation)
 Elongate an object: stretch it by inserting a box of half-lengths h at the origin.
 
template<class A >
Expr< ExprPrecision< A > > Blur (const A &a_operand, const ExprPrecision< A > a_blur, const ExprPrecision< A > a_alpha=ExprPrecision< A >(0.5))
 Blur an object: a weighted average of its values at the 27 points p + d (i, j, k), i, j, k in {-1, 0, 1}.
 
template<class A >
Expr< ExprPrecision< A > > Mollify (const A &a_operand, const ExprPrecision< A > a_dist, const size_t a_samples)
 Mollify an object: convolve it with a smooth, non-negative bump kernel sampled on an n x n x n grid spanning [-r, r]^3.
 
template<class F , class T >
BoundingVolumes::AABBT< T > approximateBoundingVolumeOctree (const F &a_function, const Vec3T< T > &a_initialLowCorner, const Vec3T< T > &a_initialHighCorner, const unsigned int a_maxTreeDepth, const T &a_safety=T(0)) noexcept
 Estimate the bounding box of a function's zero level set by octree subdivision.
 
template<class F , class T >
Vec3T< T > normal (const F &a_function, const Vec3T< T > &a_point, const T &a_delta) noexcept
 Outward unit normal of a function's level set, by central finite differences.
 
HostMemoryResource & hostMemoryResource () noexcept
 Process-wide default host memory resource.
 
EmulatedDeviceMemoryResource & emulatedDeviceMemoryResource () noexcept
 Process-wide emulated device memory resource.
 
DeviceMemoryResource & deviceMemoryResource () noexcept
 Process-wide default device memory resource.
 
ManagedMemoryResource & managedMemoryResource () noexcept
 Process-wide default managed (unified) memory resource.
 
PinnedMemoryResource & pinnedMemoryResource () noexcept
 Process-wide default pinned (page-locked) host memory resource.
 
MappedMemoryResource & mappedMemoryResource () noexcept
 Process-wide default mapped (zero-copy) pinned host memory resource.
 
template<class T , class S >
HitT< T > firstHit (const S &a_shape, const RayT< T > &a_ray, typename RayT< T >::Scalar a_tMin, typename RayT< T >::Scalar a_tMax, const RayOptions< T > &a_options=RayOptions< T >()) noexcept
 The first crossing of a shape's surface along a ray, entering or leaving.
 
template<class T , class S >
HitT< T > firstHit (const S &a_shape, const Vec3T< T > &a_from, const Vec3T< T > &a_to, T a_tMin=T(0), const RayOptions< T > &a_options=RayOptions< T >()) noexcept
 The first crossing of a shape's surface on the segment from a_from to a_to.
 
template<class T , class S >
HitStatus intersects (const S &a_shape, const RayT< T > &a_ray, typename RayT< T >::Scalar a_tMin, typename RayT< T >::Scalar a_tMax, const RayOptions< T > &a_options=RayOptions< T >()) noexcept
 Whether a ray crosses a shape's surface in [a_tMin, a_tMax].
 
template<class T , class S >
HitStatus intersects (const S &a_shape, const Vec3T< T > &a_from, const Vec3T< T > &a_to, T a_tMin=T(0), const RayOptions< T > &a_options=RayOptions< T >()) noexcept
 Whether the segment from a_from to a_to crosses a shape's surface.
 
template<class T >
std::ostream & operator<< (std::ostream &a_os, const Vec3T< T > &a_vec)
 Print a vector as (x,y,z).
 
template<class R , typename T , std::enable_if_t< std::is_arithmetic_v< R >, int > = 0>
constexpr Vec2T< T > operator* (const R &s, const Vec2T< T > &a_other) noexcept
 Scalar-left multiplication: s * vec.
 
template<class R , typename T , std::enable_if_t< std::is_arithmetic_v< R >, int > = 0>
constexpr Vec2T< T > operator/ (const R &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 >
T dot (const Vec2T< T > &u, const Vec2T< T > &v) noexcept
 Dot product of two 2D vectors.
 
template<typename T >
T length (const Vec2T< T > &v) noexcept
 Euclidean length of a 2D vector.
 
template<class R , typename T , std::enable_if_t< std::is_arithmetic_v< R >, int > = 0>
constexpr Vec3T< T > operator* (const R &s, const Vec3T< T > &u) noexcept
 Scalar-left multiplication: s * vec.
 
template<class R , typename T , std::enable_if_t< std::is_arithmetic_v< R >, int > = 0>
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 >
constexpr T dot (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 >
T length (const Vec3T< T > &v) noexcept
 Euclidean length of a 3D vector.
 

Variables

template<class T >
constexpr ExpMinOp< T > ExpMin {}
 The exponential smooth minimum, as a ready-made function object: ExpMin<T>(a, b, s).
 
template<class T >
constexpr ExpMaxOp< T > ExpMax {}
 The exponential smooth maximum, as a ready-made function object: ExpMax<T>(a, b, s).
 
template<class T >
constexpr SmoothMinOp< T > SmoothMin {}
 The polynomial smooth minimum, as a ready-made function object: SmoothMin<T>(a, b, s).
 
template<class T >
constexpr SmoothMaxOp< T > SmoothMax {}
 The polynomial smooth maximum, as a ready-made function object: SmoothMax<T>(a, b, s).
 
template<class T >
constexpr T pi = T(3.14159265358979323846L)
 The mathematical constant π, typed as T.
 
template<class P >
constexpr DistanceQuality distanceQualityOf = DistanceQualityOf<P>::value
 Shorthand for the value of DistanceQualityOf.
 
template<class S >
constexpr bool isShape = ExprDetail::ShapeInfo<S>::value
 Whether S is a shape: a trivially copyable type with a const signedDistance(const Vec3T<T>&) returning T and a const computeBoundingVolume() returning BoundingVolumes::AABBT<T>.
 
constexpr unsigned int MaxOctreeDepth = 24
 Deepest subdivision approximateBoundingVolumeOctree() accepts.
 
constexpr size_t PoolBaseAlign = 256
 Block-base alignment for every Pool, in bytes.
 
template<class P >
constexpr bool isPoolHandle = std::is_base_of_v<PoolHandle, P>
 Whether P is a pool-resident handle (derives from PoolHandle).
 

Detailed Description

Namespace containing all of EBGeometry's functionality.

EBGeometry is a header-only C++17 library for signed distance functions, constructive solid geometry (CSG), DCEL surface meshes, bounding volume hierarchies, point clouds and ray queries, on the host and on a GPU. Including EBGeometry.hpp exposes every public class and free function through this namespace, except the Random and SimpleTimer utilities (include EBGeometry_Random.hpp or EBGeometry_SimpleTimer.hpp for those).

Typedef Documentation

◆ ExprPrecision

template<class A >
using EBGeometry::ExprPrecision = typedef typename ExprDetail::ExprLike<A>::type

The precision of an expression-like type: T for Expr<T> or for a shape of precision T. Not defined for other types, so a function taking it drops out of overload resolution.

Template Parameters
AExpr<T> or shape type.

◆ ShapePrecision

template<class S >
using EBGeometry::ShapePrecision = typedef typename ExprDetail::ShapeInfo<S>::precision

The precision of a shape type: T for a shape whose box type is AABBT<T>.

Template Parameters
SShape type.

Enumeration Type Documentation

◆ BlendKind

enum class EBGeometry::BlendKind : uint8_t
strong

How a smooth union, intersection or difference blends the two extreme values.

Enumerator
Polynomial 

SmoothMinOp/SmoothMaxOp: quadratic blend over a band of width s; deepens by at most s/4.

Exponential 

ExpMinOp/ExpMaxOp: log-sum-exp blend with length scale s; deepens by at most s ln 2.

◆ DistanceQuality

enum class EBGeometry::DistanceQuality
strong

How far the value of a signed distance function can be trusted, from strongest to weakest.

Every level keeps the sign: negative inside, positive outside, zero on the surface.

Enumerator
Exact 

The value's magnitude is the Euclidean distance to the surface.

Bound 

The value's magnitude never exceeds the distance to the surface: it may underestimate, but never overestimates. Exact implies Bound.

NotADistance 

Only the sign is meaningful, so the function describes a surface (its zero level set) but says nothing about how far away it is. A BVH union of such functions is again only a sign.

◆ HitStatus

enum class EBGeometry::HitStatus : uint8_t
strong

The outcome of a ray query.

Enumerator
Miss 

The ray does not cross the surface in the interval.

Hit 

The ray crosses the surface; HitT says where.

Unresolved 

The query ran out of steps or passes before it could decide (a ray grazing the surface, say).

Function Documentation

◆ Annular()

template<class A >
Expr< ExprPrecision< A > > EBGeometry::Annular ( const A &  a_operand,
const ExprPrecision< A >  a_delta 
)
inline

A shell around an object's surface, |v| - delta.

Template Parameters
AShape or Expr type.
Parameters
[in]a_operandObject.
[in]a_deltaShell half-thickness (finite).
Returns
The shell.

◆ approximateBoundingVolumeOctree()

template<class F , class T >
BoundingVolumes::AABBT< T > EBGeometry::approximateBoundingVolumeOctree ( const F &  a_function,
const Vec3T< T > &  a_initialLowCorner,
const Vec3T< T > &  a_initialHighCorner,
const unsigned int  a_maxTreeDepth,
const T &  a_safety = T(0) 
)
inlinenoexcept

Estimate the bounding box of a function's zero level set by octree subdivision.

Subdivides the initial box depth-first into octants, keeping a cell when the function's value at its center is within (1 + a_safety) times the cell's half-diagonal, that is, when the surface may pass through it, and returns the box around the kept cells at depth a_maxTreeDepth. This relies on the function being close to a signed distance: a function whose value changes by at most the distance moved cannot have a surface farther from a cell's center than its value there. The cells are never stored; the traversal keeps a fixed stack and a running minimum and maximum, so the function allocates nothing and is callable on a device if the function is.

The function can be anything that is evaluated at a point: an object with a signedDistance(const Vec3T<T>&) member (an analytic shape, a mesh SDF or a Tape), or else a callable taking a const Vec3T<T>&.

If the initial box is empty or inverted along any axis, or the function's value at its center already rules the surface out of it, or no cell is kept at depth a_maxTreeDepth, the result is the maximal box, from -Vec3T<T>::max() to Vec3T<T>::max(): a sign that the initial box must be chosen more generously, or that the function is far from a signed distance.

Template Parameters
FFunction type.
TFloating-point precision.
Parameters
[in]a_functionFunction whose zero level set is bounded.
[in]a_initialLowCornerLow corner of the initial box.
[in]a_initialHighCornerHigh corner of the initial box.
[in]a_maxTreeDepthSubdivision depth; at most MaxOctreeDepth.
[in]a_safetySafety factor for the cell test; 0 = exact, 1 = a margin of one half-diagonal. Must be non-negative.
Returns
Box enclosing the kept cells.

◆ Blur()

template<class A >
Expr< ExprPrecision< A > > EBGeometry::Blur ( const A &  a_operand,
const ExprPrecision< A >  a_blur,
const ExprPrecision< A >  a_alpha = ExprPrecision< A >(0.5) 
)
inline

Blur an object: a weighted average of its values at the 27 points p + d (i, j, k), i, j, k in {-1, 0, 1}.

The weights are alpha^(3-m) ((1 - alpha)/2)^m for a tap m steps from the center, which sum to one, so a 1-Lipschitz object stays 1-Lipschitz.

Template Parameters
AShape or Expr type.
Parameters
[in]a_operandObject.
[in]a_blurBlur distance d (finite, >= 0).
[in]a_alphaCenter weight factor in [0, 1]; 1 = no blur.
Returns
The blurred object.

◆ 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] = clamp(v[i], lo[i], hi[i]).

◆ Complement()

template<class A >
Expr< ExprPrecision< A > > EBGeometry::Complement ( const A &  a_operand)
inline

Complement: inside and outside swapped, -v.

Template Parameters
AShape or Expr type.
Parameters
[in]a_operandObject.
Returns
The complement.

◆ 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.

◆ deviceMemoryResource()

DeviceMemoryResource & EBGeometry::deviceMemoryResource ( )
noexcept

Process-wide default device memory resource.

Returns a reference to a DeviceMemoryResource created on first use and never destroyed, so a Pool with static storage can still free its block at program exit. A free that fails because the GPU runtime has already shut down (GPU::isShutdownError()) is not an error.

Returns
Reference to the shared device resource.

◆ Difference() [1/2]

template<class A , class B >
Expr< ExprPrecision< A > > EBGeometry::Difference ( const A &  a_first,
const B &  a_second 
)
inline

Difference A \ B: max(A, -B), inside A and outside B.

Template Parameters
AShape or Expr type.
BShape or Expr type of the same precision.
Parameters
[in]a_firstObject to subtract from.
[in]a_secondObject to subtract.
Returns
The difference.

◆ Difference() [2/2]

template<class A , class B >
Expr< ExprPrecision< A > > EBGeometry::Difference ( const A &  a_first,
const std::vector< B > &  a_others 
)
inline

Difference A \ (B1 u B2 u ...): max(A, -min_i Bi).

Template Parameters
AShape or Expr type.
BShape or Expr type of the same precision.
Parameters
[in]a_firstObject to subtract from.
[in]a_othersObjects to subtract (must not be empty).
Returns
The difference.

◆ 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 A >
Expr< ExprPrecision< A > > EBGeometry::Elongate ( const A &  a_operand,
const Vec3T< ExprPrecision< A > > &  a_elongation 
)
inline

Elongate an object: stretch it by inserting a box of half-lengths h at the origin.

The value at p is the object's value at p - clamp(p, -h, h); exact outside the object only.

Template Parameters
AShape or Expr type.
Parameters
[in]a_operandObject.
[in]a_elongationHalf-lengths h (finite, >= 0).
Returns
The elongated object.

◆ emulatedDeviceMemoryResource()

EmulatedDeviceMemoryResource & EBGeometry::emulatedDeviceMemoryResource ( )
noexcept

Process-wide emulated device memory resource.

Created on first use and never destroyed, for the reason given in hostMemoryResource().

Returns
Reference to the shared emulated device resource.

◆ FiniteRepetition()

template<class A >
Expr< ExprPrecision< A > > EBGeometry::FiniteRepetition ( const A &  a_operand,
const Vec3T< ExprPrecision< A > > &  a_period,
const Vec3T< ExprPrecision< A > > &  a_repeatLo,
const Vec3T< ExprPrecision< A > > &  a_repeatHi 
)
inline

Finite repetition: copies of an object on a grid of tiles, a_repeatLo tiles below and a_repeatHi tiles above the home tile along each axis.

The value is the minimum of the object's value over all its copies, so it is a distance bound whenever the object's value is one, whether or not the object fits inside its tile. The copy in the tile p folds into, p_i - c_i round(clamp(p_i / c_i, -lo_i, hi_i)), is evaluated first, and only the copies whose box comes closer to p than that value after it; an object well inside its tile has few. A Tape evaluates the copies as a sub-program, which takes one level of its call depth.

Template Parameters
AShape or Expr type.
Parameters
[in]a_operandObject to repeat; its home copy sits in the tile around the origin.
[in]a_periodTile period along each axis (> 0).
[in]a_repeatLoTiles in the decreasing direction of each axis (>= 0; rounded to whole tiles).
[in]a_repeatHiTiles in the increasing direction of each axis (>= 0; rounded to whole tiles).
Returns
The repetition.

◆ firstHit() [1/2]

template<class T , class S >
HitT< T > EBGeometry::firstHit ( const S &  a_shape,
const RayT< T > &  a_ray,
typename RayT< T >::Scalar  a_tMin,
typename RayT< T >::Scalar  a_tMax,
const RayOptions< T > &  a_options = RayOptions< T >() 
)
inlinenoexcept

The first crossing of a shape's surface along a ray, entering or leaving.

Searches [a_tMin, a_tMax], clipped to the shape's bounding box. The crossing is reported whichever way the ray goes through it: a ray that starts inside the object reports where it leaves, with HitT::m_entering false. A shape with a ray form is ray traced; any other is marched (see the file description and RayOptions). Callable on a device.

Template Parameters
TFloating-point precision.
SShape type.
Parameters
[in]a_shapeThe shape.
[in]a_rayThe ray, with a unit direction.
[in]a_tMinStart of the interval.
[in]a_tMaxEnd of the interval.
[in]a_optionsHow to march.
Returns
The crossing, a miss, or an unresolved query.

◆ firstHit() [2/2]

template<class T , class S >
HitT< T > EBGeometry::firstHit ( const S &  a_shape,
const Vec3T< T > &  a_from,
const Vec3T< T > &  a_to,
T  a_tMin = T(0),
const RayOptions< T > &  a_options = RayOptions< T >() 
)
inlinenoexcept

The first crossing of a shape's surface on the segment from a_from to a_to.

The ray from a_from towards a_to, over [a_tMin, |a_to - a_from|]: HitT::m_t is the distance from a_from. A crossing at a_tMin is a hit; a caller stepping off a surface it is sitting on passes a small a_tMin. A segment of zero length is a miss. Callable on a device.

Template Parameters
TFloating-point precision.
SShape type.
Parameters
[in]a_shapeThe shape.
[in]a_fromStart of the segment.
[in]a_toEnd of the segment.
[in]a_tMinDistance from a_from where the search starts.
[in]a_optionsHow to march.
Returns
The crossing, a miss, or an unresolved query.

◆ hostMemoryResource()

HostMemoryResource & EBGeometry::hostMemoryResource ( )
noexcept

Process-wide default host memory resource.

Returns a reference to a HostMemoryResource created on first use and never destroyed, so a Pool with static storage can still free its block at program exit.

Returns
Reference to the shared host resource.

◆ Intersection() [1/2]

template<class A , class B >
Expr< ExprPrecision< A > > EBGeometry::Intersection ( const A &  a_first,
const B &  a_second 
)
inline

Intersection of two objects: the maximum of their values.

Template Parameters
AShape or Expr type.
BShape or Expr type of the same precision.
Parameters
[in]a_firstFirst object.
[in]a_secondSecond object.
Returns
The intersection.

◆ Intersection() [2/2]

template<class A >
Expr< ExprPrecision< A > > EBGeometry::Intersection ( const std::vector< A > &  a_operands)
inline

Intersection of any number of objects: the maximum of their values.

Template Parameters
AShape or Expr type.
Parameters
[in]a_operandsObjects (must not be empty).
Returns
The intersection.

◆ intersects() [1/2]

template<class T , class S >
HitStatus EBGeometry::intersects ( const S &  a_shape,
const RayT< T > &  a_ray,
typename RayT< T >::Scalar  a_tMin,
typename RayT< T >::Scalar  a_tMax,
const RayOptions< T > &  a_options = RayOptions< T >() 
)
inlinenoexcept

Whether a ray crosses a shape's surface in [a_tMin, a_tMax].

Stops at the first crossing found, not the nearest, where the shape's ray form allows it. Callable on a device.

Template Parameters
TFloating-point precision.
SShape type.
Parameters
[in]a_shapeThe shape.
[in]a_rayThe ray, with a unit direction.
[in]a_tMinStart of the interval.
[in]a_tMaxEnd of the interval.
[in]a_optionsHow to march.
Returns
Hit, Miss, or Unresolved.

◆ intersects() [2/2]

template<class T , class S >
HitStatus EBGeometry::intersects ( const S &  a_shape,
const Vec3T< T > &  a_from,
const Vec3T< T > &  a_to,
T  a_tMin = T(0),
const RayOptions< T > &  a_options = RayOptions< T >() 
)
inlinenoexcept

Whether the segment from a_from to a_to crosses a shape's surface.

For a marched shape, where the value has different signs at the two ends the segment crosses the surface and no search is needed; otherwise the segment is searched, since it may go in and out again. A shape with a ray form is always searched. Callable on a device.

Template Parameters
TFloating-point precision.
SShape type.
Parameters
[in]a_shapeThe shape.
[in]a_fromStart of the segment.
[in]a_toEnd of the segment.
[in]a_tMinDistance from a_from where the search starts.
[in]a_optionsHow to march.
Returns
Hit, Miss, or Unresolved.

◆ 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[0]*v[0] + v[1]*v[1]).

◆ length() [2/2]

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

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]).

◆ managedMemoryResource()

ManagedMemoryResource & EBGeometry::managedMemoryResource ( )
noexcept

Process-wide default managed (unified) memory resource.

Returns a reference to a ManagedMemoryResource created on first use and never destroyed, so a Pool with static storage can still free its block at program exit. A free that fails because the GPU runtime has already shut down (GPU::isShutdownError()) is not an error.

Returns
Reference to the shared managed resource.

◆ mappedMemoryResource()

MappedMemoryResource & EBGeometry::mappedMemoryResource ( )
noexcept

Process-wide default mapped (zero-copy) pinned host memory resource.

Returns a reference to a MappedMemoryResource created on first use and never destroyed, so a Pool with static storage can still free its block at program exit. A free that fails because the GPU runtime has already shut down (GPU::isShutdownError()) is not an error.

Returns
Reference to the shared mapped resource.

◆ 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.

Each component is Math::max of the two: the first vector's component when they compare equal or either is NaN, like std::max.

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

◆ 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.

Each component is Math::max of the two: the first vector's component when they compare equal or either is NaN, like std::max.

Template Parameters
TFloating-point precision.
Parameters
[in]uFirst vector.
[in]vSecond vector.
Returns
New vector with X[i] = 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.

Each component is Math::min of the two: the first vector's component when they compare equal or either is NaN, like std::min.

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

◆ 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.

Each component is Math::min of the two: the first vector's component when they compare equal or either is NaN, like std::min.

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

◆ Mollify()

template<class A >
Expr< ExprPrecision< A > > EBGeometry::Mollify ( const A &  a_operand,
const ExprPrecision< A >  a_dist,
const size_t  a_samples 
)
inline

Mollify an object: convolve it with a smooth, non-negative bump kernel sampled on an n x n x n grid spanning [-r, r]^3.

The kernel weights are normalized to sum to one, so a 1-Lipschitz object stays 1-Lipschitz. With r = 0 or n = 1 the object is returned unchanged.

Template Parameters
AShape or Expr type.
Parameters
[in]a_operandObject.
[in]a_distMollification distance r: the half-width of the sampling cube (finite).
[in]a_samplesSamples per axis n (between 1 and 64).
Returns
The mollified object.

◆ normal()

template<class F , class T >
Vec3T< T > EBGeometry::normal ( const F &  a_function,
const Vec3T< T > &  a_point,
const T &  a_delta 
)
inlinenoexcept

Outward unit normal of a function's level set, by central finite differences.

Approximates the gradient at a_point with step a_delta along each axis and normalizes it. The function is evaluated as in approximateBoundingVolumeOctree(). Callable on a device if the function is.

Template Parameters
FFunction type.
TFloating-point precision.
Parameters
[in]a_functionFunction to differentiate.
[in]a_pointQuery point.
[in]a_deltaFinite-difference step. Must be positive.
Returns
Unit normal at a_point. Undefined if the finite-difference gradient is zero (a_point at a local extremum of the function).

◆ Offset()

template<class A >
Expr< ExprPrecision< A > > EBGeometry::Offset ( const A &  a_operand,
const ExprPrecision< A >  a_offset 
)
inline

Offset an object's surface outward by a distance, v - r.

Exact for a dilation (r >= 0) of an exact distance; a bound for an erosion.

Template Parameters
AShape or Expr type.
Parameters
[in]a_operandObject.
[in]a_offsetOffset distance r (finite); negative erodes.
Returns
The offset object.

◆ operator*() [1/2]

template<class R , typename T , std::enable_if_t< std::is_arithmetic_v< R >, int > = 0>
constexpr Vec2T< T > EBGeometry::operator* ( const R &  s,
const Vec2T< T > &  a_other 
)
inlineconstexprnoexcept

Scalar-left multiplication: s * vec.

Template Parameters
RArithmetic type of the scalar (e.g. 2.0 * Vec2T<float>); it is converted to T first.
TFloating-point precision of the vector.
Parameters
[in]sScalar multiplier.
[in]a_otherVector.
Returns
New vector with x = T(s)*a_other[0], y = T(s)*a_other[1].

◆ operator*() [2/2]

template<class R , typename T , std::enable_if_t< std::is_arithmetic_v< R >, int > = 0>
constexpr Vec3T< T > EBGeometry::operator* ( const R &  s,
const Vec3T< T > &  u 
)
inlineconstexprnoexcept

Scalar-left multiplication: s * vec.

Template Parameters
RArithmetic type of the scalar (e.g. 2 * Vec3T<double>); it is converted to T first.
TFloating-point precision of the vector.
Parameters
[in]sScalar multiplier.
[in]uVector.
Returns
New vector with X[i] = T(s) * u[i].

◆ operator/() [1/2]

template<class R , typename T , std::enable_if_t< std::is_arithmetic_v< R >, int > = 0>
constexpr Vec2T< T > EBGeometry::operator/ ( const R &  s,
const Vec2T< T > &  a_other 
)
inlineconstexprnoexcept

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

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

Template Parameters
RArithmetic type of the scalar numerator; it is converted to T first.
TFloating-point precision of the vector.
Parameters
[in]sScalar numerator.
[in]a_otherVector whose components are the denominators.
Returns
New vector with x = T(s)/a_other[0], y = T(s)/a_other[1].

◆ operator/() [2/2]

template<class R , typename T , std::enable_if_t< std::is_arithmetic_v< R >, int > = 0>
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 T(s) / u[i].

Template Parameters
RArithmetic type of the scalar numerator; it is converted to T first.
TFloating-point precision of the vector.
Parameters
[in]sScalar numerator.
[in]uVector whose components are the denominators.
Returns
New vector with X[i] = T(s) / u[i].

◆ operator<<()

template<class T >
std::ostream & EBGeometry::operator<< ( std::ostream &  a_os,
const Vec3T< T > &  a_vec 
)
inline

Print a vector as (x,y,z).

Template Parameters
TFloating-point precision.
Parameters
[in,out]a_osOutput stream.
[in]a_vecVector to print.
Returns
Reference to the output stream after insertion.

◆ pinnedMemoryResource()

PinnedMemoryResource & EBGeometry::pinnedMemoryResource ( )
noexcept

Process-wide default pinned (page-locked) host memory resource.

Returns a reference to a PinnedMemoryResource created on first use and never destroyed, so a Pool with static storage can still free its block at program exit. A free that fails because the GPU runtime has already shut down (GPU::isShutdownError()) is not an error.

Returns
Reference to the shared pinned resource.

◆ Reflect()

template<class A >
Expr< ExprPrecision< A > > EBGeometry::Reflect ( const A &  a_operand,
const size_t  a_axis 
)
inline

Reflect an object in a coordinate plane through the origin.

Template Parameters
AShape or Expr type.
Parameters
[in]a_operandObject.
[in]a_axisAxis normal to the plane (0, 1 or 2).
Returns
The reflected object.

◆ Rotate() [1/2]

template<class A >
Expr< ExprPrecision< A > > EBGeometry::Rotate ( const A &  a_operand,
const ExprPrecision< A >  a_degrees,
const size_t  a_axis 
)
inline

Rotate an object about a coordinate axis through the origin.

Template Parameters
AShape or Expr type.
Parameters
[in]a_operandObject.
[in]a_degreesAngle in degrees, counterclockwise seen from the positive end of the axis (finite).
[in]a_axisCoordinate axis (0, 1 or 2).
Returns
The rotated object.

◆ Rotate() [2/2]

template<class A >
Expr< ExprPrecision< A > > EBGeometry::Rotate ( const A &  a_operand,
const ExprPrecision< A >  a_degrees,
const Vec3T< ExprPrecision< A > > &  a_axis 
)
inline

Rotate an object about an arbitrary axis through the origin.

Template Parameters
AShape or Expr type.
Parameters
[in]a_operandObject.
[in]a_degreesAngle in degrees, counterclockwise seen from the positive end of the axis (finite).
[in]a_axisAxis direction (finite, non-zero; need not be normalized).
Returns
The rotated object.

◆ Scale()

template<class A >
Expr< ExprPrecision< A > > EBGeometry::Scale ( const A &  a_operand,
const ExprPrecision< A >  a_factor 
)
inline

Scale an object uniformly about the origin.

The value at p is |s| times the object's value at p / s, which keeps a distance a distance.

Template Parameters
AShape or Expr type.
Parameters
[in]a_operandObject.
[in]a_factorScale factor s (finite, non-zero; a negative factor also reflects through the origin).
Returns
The scaled object.

◆ SmoothDifference() [1/2]

template<class A , class B >
Expr< ExprPrecision< A > > EBGeometry::SmoothDifference ( const A &  a_first,
const B &  a_second,
const ExprPrecision< A >  a_smooth,
const BlendKind  a_blend = BlendKind::Polynomial 
)
inline

Smooth difference A \ B: the smooth intersection of A and the complement of B.

Template Parameters
AShape or Expr type.
BShape or Expr type of the same precision.
Parameters
[in]a_firstObject to subtract from.
[in]a_secondObject to subtract.
[in]a_smoothSmoothing length (> 0).
[in]a_blendBlend kind.
Returns
The smooth difference.

◆ SmoothDifference() [2/2]

template<class A , class B >
Expr< ExprPrecision< A > > EBGeometry::SmoothDifference ( const A &  a_first,
const std::vector< B > &  a_others,
const ExprPrecision< A >  a_smooth,
const BlendKind  a_blend = BlendKind::Polynomial 
)
inline

Smooth difference A \ (B1, B2, ...): the smooth intersection of A and the complement of each Bi.

Template Parameters
AShape or Expr type.
BShape or Expr type of the same precision.
Parameters
[in]a_firstObject to subtract from.
[in]a_othersObjects to subtract (must not be empty).
[in]a_smoothSmoothing length (> 0).
[in]a_blendBlend kind.
Returns
The smooth difference.

◆ SmoothIntersection() [1/2]

template<class A , class B >
Expr< ExprPrecision< A > > EBGeometry::SmoothIntersection ( const A &  a_first,
const B &  a_second,
const ExprPrecision< A >  a_smooth,
const BlendKind  a_blend = BlendKind::Polynomial 
)
inline

Smooth intersection of two objects: a smooth maximum of their values.

Template Parameters
AShape or Expr type.
BShape or Expr type of the same precision.
Parameters
[in]a_firstFirst object.
[in]a_secondSecond object.
[in]a_smoothSmoothing length (> 0).
[in]a_blendBlend kind.
Returns
The smooth intersection.

◆ SmoothIntersection() [2/2]

template<class A >
Expr< ExprPrecision< A > > EBGeometry::SmoothIntersection ( const std::vector< A > &  a_operands,
const ExprPrecision< A >  a_smooth,
const BlendKind  a_blend = BlendKind::Polynomial 
)
inline

Smooth intersection of any number of objects: a smooth maximum of the two largest values.

Template Parameters
AShape or Expr type.
Parameters
[in]a_operandsObjects (must not be empty).
[in]a_smoothSmoothing length (> 0).
[in]a_blendBlend kind.
Returns
The smooth intersection.

◆ SmoothUnion() [1/2]

template<class A , class B >
Expr< ExprPrecision< A > > EBGeometry::SmoothUnion ( const A &  a_first,
const B &  a_second,
const ExprPrecision< A >  a_smooth,
const BlendKind  a_blend = BlendKind::Polynomial 
)
inline

Smooth union of two objects: a smooth minimum of their values.

Template Parameters
AShape or Expr type.
BShape or Expr type of the same precision.
Parameters
[in]a_firstFirst object.
[in]a_secondSecond object.
[in]a_smoothSmoothing length (> 0).
[in]a_blendBlend kind.
Returns
The smooth union.

◆ SmoothUnion() [2/2]

template<class A >
Expr< ExprPrecision< A > > EBGeometry::SmoothUnion ( const std::vector< A > &  a_operands,
const ExprPrecision< A >  a_smooth,
const BlendKind  a_blend = BlendKind::Polynomial 
)
inline

Smooth union of any number of objects: a smooth minimum of the two smallest values.

Only the two smallest values are blended, which differs from folding a binary smooth minimum. A Tape evaluates a smooth union of many objects with a BVH, as for Union().

Template Parameters
AShape or Expr type.
Parameters
[in]a_operandsObjects (must not be empty).
[in]a_smoothSmoothing length (> 0).
[in]a_blendBlend kind.
Returns
The smooth union.

◆ toExpr()

template<class A >
Expr< ExprPrecision< A > > EBGeometry::toExpr ( const A &  a_operand)
inline

Convert a shape or an Expr to an Expr.

Template Parameters
AShape or Expr type.
Parameters
[in]a_operandShape or Expr.
Returns
The Expr.

◆ Translate()

template<class A >
Expr< ExprPrecision< A > > EBGeometry::Translate ( const A &  a_operand,
const Vec3T< ExprPrecision< A > > &  a_shift 
)
inline

Translate an object by a shift.

Template Parameters
AShape or Expr type.
Parameters
[in]a_operandObject.
[in]a_shiftShift (finite).
Returns
The translated object, whose value at p is the object's value at p - a_shift.

◆ Union() [1/2]

template<class A , class B >
Expr< ExprPrecision< A > > EBGeometry::Union ( const A &  a_first,
const B &  a_second 
)
inline

Union of two objects: the minimum of their values.

Template Parameters
AShape or Expr type.
BShape or Expr type of the same precision.
Parameters
[in]a_firstFirst object.
[in]a_secondSecond object.
Returns
The union.

◆ Union() [2/2]

template<class A >
Expr< ExprPrecision< A > > EBGeometry::Union ( const std::vector< A > &  a_operands)
inline

Union of any number of objects: the minimum of their values.

A Tape evaluates a union of many objects with a BVH over their boxes (see TapeOptions), unless one of them is not a distance. With exact distances the value is the plain minimum; with operands that are only bounds it can be larger, but keeps the sign and is still a bound.

Template Parameters
AShape or Expr type.
Parameters
[in]a_operandsObjects (must not be empty).
Returns
The union.

Variable Documentation

◆ distanceQualityOf

template<class P >
constexpr DistanceQuality EBGeometry::distanceQualityOf = DistanceQualityOf<P>::value
inlineconstexpr

Shorthand for the value of DistanceQualityOf.

.

Template Parameters
PType to inspect.

◆ ExpMax

template<class T >
constexpr ExpMaxOp<T> EBGeometry::ExpMax {}
inlineconstexpr

The exponential smooth maximum, as a ready-made function object: ExpMax<T>(a, b, s).

Callable from host and device code.

Template Parameters
TFloating-point precision.

◆ ExpMin

template<class T >
constexpr ExpMinOp<T> EBGeometry::ExpMin {}
inlineconstexpr

The exponential smooth minimum, as a ready-made function object: ExpMin<T>(a, b, s).

Callable from host and device code, for instance as a BVHSmoothUnion's Blend.

Template Parameters
TFloating-point precision.

◆ isPoolHandle

template<class P >
constexpr bool EBGeometry::isPoolHandle = std::is_base_of_v<PoolHandle, P>
inlineconstexpr

Whether P is a pool-resident handle (derives from PoolHandle).

Template Parameters
PType to inspect.

◆ isShape

template<class S >
constexpr bool EBGeometry::isShape = ExprDetail::ShapeInfo<S>::value
inlineconstexpr

Whether S is a shape: a trivially copyable type with a const signedDistance(const Vec3T<T>&) returning T and a const computeBoundingVolume() returning BoundingVolumes::AABBT<T>.

The analytic shapes, the mesh SDFs, the BVH unions and Tape are shapes. A shape may also have a static constexpr distanceQuality member (see DistanceQuality); without one it counts as DistanceQuality::Bound.

Every shape's value goes by the one name signedDistance, whatever its distance quality, and the two together say what the value means. The sign is the contract every shape keeps: negative inside, positive outside, zero on the surface. The magnitude is what the distance quality says: the distance to the surface (Exact), at most that distance (Bound), or nothing (NotADistance).

Template Parameters
SCandidate type.

◆ MaxOctreeDepth

constexpr unsigned int EBGeometry::MaxOctreeDepth = 24
constexpr

Deepest subdivision approximateBoundingVolumeOctree() accepts.

A cell at this depth is 2^-24 of the initial box along each axis, below the resolution of a float coordinate in that box. The bound sizes the function's fixed traversal stack.

◆ pi

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

The mathematical constant π, typed as T.

Defined to 21 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.

◆ PoolBaseAlign

constexpr size_t EBGeometry::PoolBaseAlign = 256
inlineconstexpr

Block-base alignment for every Pool, in bytes.

256 matches the cudaMalloc / hipMalloc base-address guarantee and is >= the natural alignment of every type the library stores in a pool (including the 64-byte-aligned SoA child-AABB blocks), so base() + (an alignof(T)-aligned offset) is always correctly aligned, and stays so after a grow (the new block is also 256-aligned) and after a mirror (a device base is >= 256-aligned). Defined here, in the placement layer, so both Pool and the device MemoryResource allocators reference a single source of truth.

◆ SmoothMax

template<class T >
constexpr SmoothMaxOp<T> EBGeometry::SmoothMax {}
inlineconstexpr

The polynomial smooth maximum, as a ready-made function object: SmoothMax<T>(a, b, s).

Callable from host and device code.

Template Parameters
TFloating-point precision.

◆ SmoothMin

template<class T >
constexpr SmoothMinOp<T> EBGeometry::SmoothMin {}
inlineconstexpr

The polynomial smooth minimum, as a ready-made function object: SmoothMin<T>(a, b, s).

Callable from host and device code, for instance as a BVHSmoothUnion's Blend.

Template Parameters
TFloating-point precision.