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  Language
 The .ebg language: a model (geometry, its regions and materials, and the domains a solver computes in) written in a text file and read at run time, instead of composed in compiled C++.
 
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  SFCDetail
 The Morton grid and sort key shared by the cloud BVH builds and GPU::mortonOrder().
 
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  SphereCloud
 The sphere, query result and sphere sources of SphereCloudBVH.
 
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 or more types. More...
 
class  BVHUnion
 BVH-accelerated union of many primitives of one or more types. More...
 
class  CappedConeSDF
 Signed distance field for a capped cone (a frustum): a cone cut flat at both ends, between two end centers, with a radius at each. More...
 
class  CappedTorusSDF
 Signed distance field for a capped torus: an arc of a torus with flat ends, such as a pipe elbow. 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...
 
struct  ClosestPoint
 The point of a mesh closest to a query point, as the mesh SDFs' closestPoint() returns it. More...
 
struct  ComponentOptions
 How connectedComponents() resolves the space it searches. More...
 
class  ConeSDF
 Signed distance field for a finite cone. More...
 
struct  ConnectedComponent
 One connected component: a connected part of space where every point is in one region (or one group of regions). More...
 
class  ConnectedComponents
 The connected components of the regions of a tape, or of groups of them (see connectedComponents()): how many each has, and for each its volume, box, a point in it, whether it reaches the box searched, and the components it touches. More...
 
struct  ContourSample
 A section plane's field at a point (RegionView::contourSample()): its value, negative inside, and whether its lines there are secondary, drawn in another color (Render::Settings::m_isoSecondaryColor): a domain's excluded regions. More...
 
struct  CrossingT
 Where a ray first crosses a surface, without the normal or the primitive there: what firstCrossing() returns. More...
 
class  CutHollowSphereSDF
 Signed distance field for a cut hollow sphere: a spherical shell of some thickness, the part above a horizontal plane, such as a dome or a radome. More...
 
class  CutSphereSDF
 Signed distance field for a cut sphere: the part of a sphere above a horizontal plane, a dome or a sphere with a flat bottom. 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  Domain
 A computational domain over a tape, for a downstream code (a solver EBGeometry does not provide): the regions it computes in (its subdomains) and its surface groups (each a set of surfaces the caller gives one meaning, a boundary condition say: named by the caller, numbered here), with the queries a cut-cell code makes. More...
 
class  DomainSetup
 How a domain is made: its subdomains (the regions each computes in) and its surface groups (the selectors of each), as a plain value on the host, to build, copy, compare and edit. More...
 
class  EllipsoidSDF
 Signed distance field for an ellipsoid with its semi-axes along x, y and z. 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  ExprIndex
 The nodes of an expression, numbered, with the leaves below each and their labels: on the host, the way from what a Tape reports (a leaf, see LeafRef::m_leaf and HitT::m_primitive) back to the expression. More...
 
struct  FaceGroups
 Named groups of a mesh's faces: an OBJ file's g and o groups, or the named solids of an ASCII STL file, as the readers keep them (PolygonSoup::getFaceGroups()). 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...
 
struct  LabelId
 The number of a label, typed by what it labels, so that a number of one kind cannot index a table of another: a surface label's number does not compile where a material's is expected. More...
 
struct  LeafRef
 The deciding leaf of a composition at a point: the primitive whose surface the composed value comes from there, as Tape::closestLeaf() reports it. 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...
 
struct  MaterialLabelTag
 The tag of material labels (MaterialLabel()). 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...
 
struct  PieceCoverage
 How surface groups cover a piece: how much of it they hold, and the surface group when one holds all of it. 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  PolygonPrismSDF
 Signed distance field for a regular prism: a regular polygon of n sides, extruded between two end centers. 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  PossiblePiece
 A piece of surface an object may have: a surface between two regions, the later inside. 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, K, Ps... > >
 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 a primitive type has a ray form (and marched one primitive at a time otherwise), and callable on a device. More...
 
struct  RayForm< CappedConeSDF< T > >
 CappedConeSDF's ray form: the roots of the cone's quadratic, clipped by the slab between its ends. Exact, 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< CutSphereSDF< T > >
 CutSphereSDF's ray form: the sphere's span clipped by the half-space above the cut. 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< EllipsoidSDF< T > >
 EllipsoidSDF's ray form: the roots of a quadratic, in coordinates where the ellipsoid is the unit sphere. 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< Fused::SmoothCombineOp< T, IsUnion >, Cs... > >
 The ray form of a fused smooth union, intersection or difference (an intersection with a complement): the plain operation traced exactly where its operands allow, and the smooth one marched only where it may differ from it. Callable on a device. 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< PolygonPrismSDF< T > >
 PolygonPrismSDF's ray form: the half-spaces of its sides, clipped by the slab between its ends. 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< RegionView< TapeType > >
 A RegionView traced along a ray by its own firstHit() (see RegionView). More...
 
struct  RayForm< SphereCloudBVH< T, K, W > >
 SphereCloudBVH's ray form: the union of the spans of the spheres the ray passes through, found by walking the BVH nearest box first and leaving out the boxes beyond what the union so far is known up to. Exact, 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  RayForm< TubeSDF< T > >
 TubeSDF's ray form: the outer cylinder's span less the inner cylinder's, which leaves up to two spans. Exact, and callable on a device. More...
 
struct  RayForm< WedgeSDF< T > >
 WedgeSDF's ray form: the intersection of the half-spaces behind its two faces. 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  RegionNames
 The names of an object's regions, materials, surfaces and surface labels, from its expression's index, and of surface groups: what a viewer shows a piece of surface or a group by (Render::view()). More...
 
class  RegionNeighborhood
 Some regions of an expression with their neighbors: a smaller expression in which those regions have the same solids and the same surfaces, with the same regions on both sides of each, numbered anew (see regionNeighborhood()). More...
 
struct  RegionSettings
 How the regions of an object are shown (see RegionView): which regions are visible, what a surface is colored and named by, the surfaces shown alone or seen through, and a domain's surface groups. More...
 
class  RegionView
 The visible regions of a tape, as a shape to look at: its surfaces are the regions' surfaces, the internal ones between two regions included, found exactly along a ray. More...
 
class  RequireError
 What a failed EBGEOMETRY_REQUIRE throws on the host inside a ThrowOnRequire scope: its message, as it would have been printed. More...
 
class  RoundConeSDF
 Signed distance field for a round cone: two spheres, of different radii, and the cone tangent to both, like a capsule with a radius at each end. 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...
 
struct  SphereAoSoA
 A group of up to W spheres carrying their cloud indices: a PointAoSoA<T, W> of the centers, and one more lane array of the radii. More...
 
class  SphereCloudBVH
 A BVH over spheres of differing radii (polydisperse particles), with the signed distance to their union, the closest sphere, the contacts between spheres, and exact rays. More...
 
class  SphereSDF
 Signed distance field for a sphere. More...
 
class  Subdomains
 The subdomains of a domain (see Domain), read on the host or a device: the subdomain of each region of its tape, and what a surface is to them. More...
 
class  SurfaceGroups
 A domain's surface groups, read on the host or a device: each group a set of surfaces, given by its selectors (SurfaceSelector), that the caller gives one meaning (a boundary condition, an exchange with another code), and the group of a surface, so that a surface found at a point (Domain::closestSurface()) gives its group, and the group its meaning. More...
 
struct  SurfaceHitT
 A ray's first crossing of a shape's surface, with the surface it crossed, as firstSurface() reports it. More...
 
class  SurfaceInventory
 What an expression's index says about its surfaces, kept for checking surface groups against them without the index: each surface's shape (leaf), each shape's parts and their labels, the pairs of regions each may separate, and each region's material. More...
 
struct  SurfaceLabelTag
 The tag of surface labels (SurfaceLabel()). More...
 
struct  SurfaceLevel
 One level a surface belongs to (SurfaceInventory::levelsOf()): the surface itself, its shape, or a node of the expression above it, with the contiguous range of surfaces it covers. More...
 
struct  SurfacePiece
 One piece of an object's surface, as found: a shape's surface between two regions (see SurfaceSelector::piece()), with the parts of it seen. More...
 
struct  SurfaceRef
 The surface that decides a shape's value at a point, as closestSurface() reports it. More...
 
struct  SurfaceSelector
 Conditions on a point of a surface, all of which must hold; an unset one (Any) matches anything. 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  ThrowOnRequire
 While an object of this class lives, a failed EBGEOMETRY_REQUIRE on this thread throws RequireError instead of aborting: for a program that builds objects from input it does not control (the .ebg reader), so that a bad value is an error it reports, not the end of the program. 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  TubeSDF
 Signed distance field for a tube (a pipe): the space between two coaxial cylinders, cut flat at two end centers. More...
 
class  Vec2T
 Two-dimensional vector class with arithmetic operators. More...
 
class  Vec3T
 Three-dimensional vector class with arithmetic operators. More...
 
class  WedgeSDF
 Signed distance field for an infinite wedge: a knife edge. 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.
 
using SurfaceLabelId = LabelId< SurfaceLabelTag >
 The number of a surface label: SurfaceLabel() names surfaces, and the tape and ExprIndex number the names.
 
using MaterialLabelId = LabelId< MaterialLabelTag >
 The number of a material label: MaterialLabel() names the material of a region (see Overlay()), and ExprIndex numbers the names.
 

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  Accelerate : uint8_t { None , BVH }
 How a Tape evaluates a union of many objects: as written, or through a BVH over the objects' boxes. More...
 
enum class  HitStatus : uint8_t { Miss , Hit , Unresolved }
 The outcome of a ray query. More...
 
enum class  RegionColoring : uint8_t {
  Region , Material , SurfaceLabel , Surface ,
  Part , Interface , SurfaceGroup
}
 What a view of regions names a surface by, the key a renderer colors by (Render::ColorBy::Primitive). More...
 
enum class  SurfaceRole : uint8_t { None , Boundary , Interface , Internal }
 What a surface is to a domain, at a point, from the regions on its two sides (see Subdomains::role()). More...
 
enum class  Coverage : uint8_t { None , Partly , Full }
 How much of a piece a domain's surface groups hold. More...
 

Functions

template<class P , class... Ps, std::enable_if_t<!(CSGDetail::isBox< Ps >||...), int > = 0>
 BVHUnion (Pool &a_pool, const std::vector< P > &a_first, const std::vector< Ps > &... a_primitives) -> BVHUnion< CSGDetail::PrimitivePrecision< P >, BVH::DefaultBranchingRatio< CSGDetail::PrimitivePrecision< P > >(), P, Ps... >
 A union of the given arrays' types, of the first type's precision and the default branching factor.
 
template<class P , class... Ps>
 BVHUnion (Pool &a_pool, const BVH::BuildSettings &a_settings, const std::vector< P > &a_first, const std::vector< Ps > &... a_primitives) -> BVHUnion< CSGDetail::PrimitivePrecision< P >, BVH::DefaultBranchingRatio< CSGDetail::PrimitivePrecision< P > >(), P, Ps... >
 A union of the given arrays' types, built with settings.
 
template<class P , class B , std::enable_if_t< CSGDetail::isBox< B >, int > = 0>
 BVHUnion (Pool &a_pool, const std::vector< P > &a_first, const std::vector< B > &a_boxes) -> BVHUnion< CSGDetail::PrimitivePrecision< P >, BVH::DefaultBranchingRatio< CSGDetail::PrimitivePrecision< P > >(), P >
 A union of one type with the caller's boxes.
 
template<class P , class B , class... Rest, std::enable_if_t< CSGDetail::isBox< B >, int > = 0>
 BVHUnion (Pool &a_pool, const std::vector< P > &a_first, const std::vector< B > &a_boxes, BVH::Construction a_construction, const Rest &... a_rest) -> BVHUnion< CSGDetail::PrimitivePrecision< P >, BVH::DefaultBranchingRatio< CSGDetail::PrimitivePrecision< P > >(), P >
 A union of one type with the caller's boxes and a construction method.
 
template<class P , class... Ps, std::enable_if_t<!(CSGDetail::isBox< Ps >||...), int > = 0>
 BVHSmoothUnion (Pool &a_pool, CSGDetail::PrimitivePrecision< P > a_smoothLen, const std::vector< P > &a_first, const std::vector< Ps > &... a_primitives) -> BVHSmoothUnion< CSGDetail::PrimitivePrecision< P >, BVH::DefaultBranchingRatio< CSGDetail::PrimitivePrecision< P > >(), SmoothMinOp< CSGDetail::PrimitivePrecision< P > >, P, Ps... >
 A smooth union of the given arrays' types with the default blend.
 
template<class B , class P , class... Ps, std::enable_if_t<!CSGDetail::isVector< B >, int > = 0>
 BVHSmoothUnion (Pool &a_pool, CSGDetail::PrimitivePrecision< P > a_smoothLen, B a_blend, const std::vector< P > &a_first, const std::vector< Ps > &... a_primitives) -> BVHSmoothUnion< CSGDetail::PrimitivePrecision< P >, BVH::DefaultBranchingRatio< CSGDetail::PrimitivePrecision< P > >(), B, P, Ps... >
 A smooth union of the given arrays' types with a blend.
 
template<class B , class P , class... Ps, std::enable_if_t<!CSGDetail::isVector< B >, int > = 0>
 BVHSmoothUnion (Pool &a_pool, const BVH::BuildSettings &a_settings, CSGDetail::PrimitivePrecision< P > a_smoothLen, B a_blend, const std::vector< P > &a_first, const std::vector< Ps > &... a_primitives) -> BVHSmoothUnion< CSGDetail::PrimitivePrecision< P >, BVH::DefaultBranchingRatio< CSGDetail::PrimitivePrecision< P > >(), B, P, Ps... >
 A smooth union of the given arrays' types with settings and a blend.
 
template<class P , class V , std::enable_if_t< CSGDetail::isBox< V >, int > = 0>
 BVHSmoothUnion (Pool &a_pool, const std::vector< P > &a_first, const std::vector< V > &a_boxes, CSGDetail::PrimitivePrecision< P > a_smoothLen) -> BVHSmoothUnion< CSGDetail::PrimitivePrecision< P >, BVH::DefaultBranchingRatio< CSGDetail::PrimitivePrecision< P > >(), SmoothMinOp< CSGDetail::PrimitivePrecision< P > >, P >
 A smooth union of one type with the caller's boxes and the default blend.
 
template<class P , class V , class B , class... Rest, std::enable_if_t< CSGDetail::isBox< V >, int > = 0>
 BVHSmoothUnion (Pool &a_pool, const std::vector< P > &a_first, const std::vector< V > &a_boxes, CSGDetail::PrimitivePrecision< P > a_smoothLen, B a_blend, const Rest &... a_rest) -> BVHSmoothUnion< CSGDetail::PrimitivePrecision< P >, BVH::DefaultBranchingRatio< CSGDetail::PrimitivePrecision< P > >(), B, P >
 A smooth union of one type with the caller's boxes and a blend.
 
template<class T , class... UserPrimitives>
ConnectedComponents< T > connectedComponents (const Tape< T, UserPrimitives... > &a_tape, const ComponentOptions< T > &a_options)
 The connected components of every region of a tape, the outside (region 0) included: its enclosed cavities, and the separate bodies of a region.
 
template<class T , class... UserPrimitives>
ConnectedComponents< T > connectedComponents (const Tape< T, UserPrimitives... > &a_tape, const std::vector< uint32_t > &a_groupOf, const ComponentOptions< T > &a_options)
 The connected components of groups of a tape's regions: regions of one group that touch form one component (materials: a_groupOf[r] the material of region r, say).
 
template<class T , class... UserPrimitives>
ConnectedComponents< T > connectedComponents (const Domain< T, UserPrimitives... > &a_domain, const ComponentOptions< T > &a_options)
 The connected components of a domain's subdomains, and of the regions it excludes: group s is subdomain s, group getNumSubdomainFunctions() - 1 the excluded regions (Domain::Excluded).
 
template<class T , class... UserPrimitives>
 Domain (Pool &, const Tape< T, UserPrimitives... > &, const DomainSetup &) -> Domain< T, UserPrimitives... >
 Deduce a domain's tape from the constructor.
 
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, Accelerate a_accelerate=Accelerate::None)
 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, const Accelerate a_accelerate=Accelerate::None)
 Smooth union of any number of objects: a smooth minimum of the two smallest values.
 
template<class A >
Expr< ExprPrecision< A > > SmoothUnion (const std::vector< A > &a_operands, const ExprPrecision< A > a_smooth, const Accelerate a_accelerate)
 Smooth union of any number of objects with the polynomial blend, through a BVH or as written.
 
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, Accelerate a_accelerate=Accelerate::None)
 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 A >
Expr< ExprPrecision< A > > SurfaceLabel (const A &a_operand, std::string a_name)
 Name an object: every leaf below it gets the label, unless a part of it has a label of its own.
 
template<class A >
Expr< ExprPrecision< A > > SurfaceLabel (const A &a_operand, FaceGroups a_groups)
 Name a shape's parts by group (see hasParts): each part in a group gets the label of the group's name, which wins over any label above it; a part in no group keeps those.
 
template<class A >
Expr< ExprPrecision< A > > Overlay (const std::vector< A > &a_operands)
 Regions by priority, a priority union: each operand is a region of its own, later operands on top of earlier ones where they overlap; the outside, region 0, is the background.
 
template<class A , class B , class... Rest>
Expr< ExprPrecision< A > > Overlay (const A &a_first, const B &a_second, const Rest &... a_rest)
 Regions by priority, of two or more operands, each on top of the ones before it (see Overlay()).
 
Expr< double > Overlay (std::initializer_list< Expr< double > > a_operands)
 Regions by priority, of a braced list of shapes and Exprs of any types, double precision: Overlay({air, jacket, CylinderSDF<double>(...)}) (see Overlay()).
 
Expr< float > Overlay (std::initializer_list< Expr< float > > a_operands)
 Regions by priority, of a braced list of shapes and Exprs of any types, single precision (see Overlay()).
 
template<class A >
Expr< ExprPrecision< A > > MaterialLabel (const A &a_operand, std::string a_name)
 Name the material of a region: an operand of an Overlay, a whole Overlay nested in another (a default for its regions without one of their own), or a whole object.
 
template<class A >
Expr< ExprPrecision< A > > RegionName (const A &a_operand, std::string a_name)
 Name a region: an operand of an Overlay ("fluid", "wall"), or a whole Overlay nested in another (its region group).
 
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 , class S >
CrossingT< T > firstCrossing (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, as firstHit() finds it, without the normal or the primitive there.
 
template<class T , class S >
CrossingT< T > firstCrossing (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, without the normal or the primitive there.
 
template<class T , class S >
SurfaceHitT< T > firstSurface (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
 A ray's first crossing of a shape's surface, and the surface it crossed: the ray counterpart of closestSurface(), as firstHit() is of signedDistance().
 
template<class T , class S >
SurfaceHitT< T > firstSurface (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, and the surface crossed (see firstSurface() for a ray, and firstHit() for the segment).
 
template<class T >
RegionNeighborhood< T > regionNeighborhood (const Expr< T > &a_expr, const std::vector< uint32_t > &a_regions)
 Some regions of an expression and their neighbors: the regions that may touch them, as a smaller expression.
 
template<class T >
std::ostream & operator<< (std::ostream &a_os, const Vec3T< T > &a_vec)
 Print a vector as (x,y,z).
 
template<class TapeType >
std::vector< SurfacePiece< ShapePrecision< TapeType > > > findSurfacePieces (const TapeType &a_tape, const uint32_t a_resolution=64)
 The pieces of surface an object with regions has, as rays find them: every surface between every pair of regions they cross, each once, in the order first found.
 
std::vector< PossiblePiece > possiblePieces (const SurfaceInventory &a_inventory)
 Every piece of surface an object may have: each surface between each pair of regions its index says it may separate. A superset: every piece the object has is listed (findSurfacePieces() confirms which), and some listed may not occur.
 
PieceCoverage coverageOf (const PossiblePiece &a_piece, const SurfaceInventory &a_inventory, const DomainSetup &a_setup, const std::vector< uint32_t > &a_parts)
 How a domain's surface groups cover a piece an object may have, judged on the parts of it found (a SurfacePiece's m_parts): a shape's parts need not all lie between the piece's two regions (a channel's side against the solid it is bored through, its caps against the outside), and a part that does not cannot be in a group there.
 
PieceCoverage coverageOf (const PossiblePiece &a_piece, const SurfaceInventory &a_inventory, const DomainSetup &a_setup)
 How a domain's surface groups cover a piece an object may have: exactly, part by part when its selectors tell parts apart.
 
template<class T , class S >
SurfaceRef< T > closestSurface (const S &a_shape, const Vec3T< T > &a_point) noexcept
 The surface of any shape that decides its value at a point: a container's closestSurface() (a tape, a BVH union, a sphere cloud), and for any other shape surface 0 with its part (see hasParts). For code templated on a shape. Callable on a device.
 
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).
 
template<class S , class = void>
constexpr bool hasRegionVisibility = false
 Whether a shape's regions are shown by region settings (RegionView): the primary template is false.
 
template<class S , class T >
constexpr bool hasSurfaces = SurfaceDetail::HasSurfaces<S, T>::value
 Whether a shape holds several surfaces: it has uint32_t getNumSurfaces() const (host) and SurfaceRef<T> closestSurface(const Vec3T<T>&) const (host and device), which name its members.
 
template<class S , class T >
constexpr bool hasParts = SurfaceDetail::HasParts<S, T>::value
 Whether a shape has several parts: it has uint32_t getNumParts() const (host) and uint32_t closestPart(const Vec3T<T>&) const (host and device), which reads the part from its own formula at a point in its frame: the term that decides the value there (a box's face, a cylinder's side or cap, a mesh's face). A part belongs to the shape, never to a composition of it: a face a difference cuts into two pieces is one part. A shape without them has one part, 0.
 

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

◆ Accelerate

enum class EBGeometry::Accelerate : uint8_t
strong

How a Tape evaluates a union of many objects: as written, or through a BVH over the objects' boxes.

Enumerator
None 

As written: the tape evaluates every operand, however many there are.

BVH 

Through a BVH over the operands' boxes, however many there are.

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

◆ Coverage

enum class EBGeometry::Coverage : uint8_t
strong

How much of a piece a domain's surface groups hold.

Enumerator
None 

No part of it.

Partly 

Some parts, not all.

Full 

All of it.

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

◆ RegionColoring

enum class EBGeometry::RegionColoring : uint8_t
strong

What a view of regions names a surface by, the key a renderer colors by (Render::ColorBy::Primitive).

Enumerator
Region 

The region the surface belongs to, as seen.

Material 

That region's material.

SurfaceLabel 

The surface's label (SurfaceLabel()).

Surface 

The surface itself (SurfaceRef::m_surface): each shape, each member of a collection.

Part 

The surface's part: a box's face, a mesh's face.

Interface 

The pair of regions on its two sides there (see RegionSettings::interfaceKey()).

SurfaceGroup 

The surface group the surface is in (RegionSettings::m_surfaceGroups), or none.

◆ SurfaceRole

enum class EBGeometry::SurfaceRole : uint8_t
strong

What a surface is to a domain, at a point, from the regions on its two sides (see Subdomains::role()).

Enumerator
None 

Neither side is in a subdomain: the solver does not cut it.

Boundary 

One side is in a subdomain: cut once, from that side; its surface group gives its meaning (a boundary condition, say).

Interface 

The two sides are in two different subdomains: one surface the solver couples across.

Internal 

Both sides are in the same subdomain (two of its regions touching): the solver decides; usually not cut.

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.

◆ BVHSmoothUnion() [1/5]

template<class B , class P , class... Ps, std::enable_if_t<!CSGDetail::isVector< B >, int > = 0>
EBGeometry::BVHSmoothUnion ( Pool &  a_pool,
const BVH::BuildSettings &  a_settings,
CSGDetail::PrimitivePrecision< P >  a_smoothLen,
B  a_blend,
const std::vector< P > &  a_first,
const std::vector< Ps > &...  a_primitives 
) -> BVHSmoothUnion< CSGDetail::PrimitivePrecision< P >, BVH::DefaultBranchingRatio< CSGDetail::PrimitivePrecision< P > >(), B, P, Ps... >

A smooth union of the given arrays' types with settings and a blend.

Template Parameters
BBlend type.
PFirst primitive type.
PsThe others.
Parameters
[in]a_poolPool.
[in]a_settingsConstruction method and leaf sizes.
[in]a_smoothLenSmoothing length.
[in]a_blendSmooth-minimum operator.
[in]a_firstThe first type's primitives.
[in]a_primitivesThe other types' primitives.

◆ BVHSmoothUnion() [2/5]

template<class P , class V , std::enable_if_t< CSGDetail::isBox< V >, int > = 0>
EBGeometry::BVHSmoothUnion ( Pool &  a_pool,
const std::vector< P > &  a_first,
const std::vector< V > &  a_boxes,
CSGDetail::PrimitivePrecision< P >  a_smoothLen 
) -> BVHSmoothUnion< CSGDetail::PrimitivePrecision< P >, BVH::DefaultBranchingRatio< CSGDetail::PrimitivePrecision< P > >(), SmoothMinOp< CSGDetail::PrimitivePrecision< P > >, P >

A smooth union of one type with the caller's boxes and the default blend.

Template Parameters
PPrimitive type.
VBox type.
Parameters
[in]a_poolPool.
[in]a_firstThe first type's primitives.
[in]a_boxesThe primitives' boxes.
[in]a_smoothLenSmoothing length.

◆ BVHSmoothUnion() [3/5]

template<class P , class V , class B , class... Rest, std::enable_if_t< CSGDetail::isBox< V >, int > = 0>
EBGeometry::BVHSmoothUnion ( Pool &  a_pool,
const std::vector< P > &  a_first,
const std::vector< V > &  a_boxes,
CSGDetail::PrimitivePrecision< P >  a_smoothLen,
B  a_blend,
const Rest &...  a_rest 
) -> BVHSmoothUnion< CSGDetail::PrimitivePrecision< P >, BVH::DefaultBranchingRatio< CSGDetail::PrimitivePrecision< P > >(), B, P >

A smooth union of one type with the caller's boxes and a blend.

Template Parameters
PPrimitive type.
VBox type.
BBlend type.
RestThe construction method and leaf sizes, if given.
Parameters
[in]a_poolPool.
[in]a_firstThe first type's primitives.
[in]a_boxesThe primitives' boxes.
[in]a_smoothLenSmoothing length.
[in]a_blendSmooth-minimum operator.
[in]a_restThe leaf sizes (and for a smooth union, the construction method), if given.

◆ BVHSmoothUnion() [4/5]

template<class B , class P , class... Ps, std::enable_if_t<!CSGDetail::isVector< B >, int > = 0>
EBGeometry::BVHSmoothUnion ( Pool &  a_pool,
CSGDetail::PrimitivePrecision< P >  a_smoothLen,
B  a_blend,
const std::vector< P > &  a_first,
const std::vector< Ps > &...  a_primitives 
) -> BVHSmoothUnion< CSGDetail::PrimitivePrecision< P >, BVH::DefaultBranchingRatio< CSGDetail::PrimitivePrecision< P > >(), B, P, Ps... >

A smooth union of the given arrays' types with a blend.

Template Parameters
BBlend type.
PFirst primitive type.
PsThe others.
Parameters
[in]a_poolPool.
[in]a_smoothLenSmoothing length.
[in]a_blendSmooth-minimum operator.
[in]a_firstThe first type's primitives.
[in]a_primitivesThe other types' primitives.

◆ BVHSmoothUnion() [5/5]

template<class P , class... Ps, std::enable_if_t<!(CSGDetail::isBox< Ps >||...), int > = 0>
EBGeometry::BVHSmoothUnion ( Pool &  a_pool,
CSGDetail::PrimitivePrecision< P >  a_smoothLen,
const std::vector< P > &  a_first,
const std::vector< Ps > &...  a_primitives 
) -> BVHSmoothUnion< CSGDetail::PrimitivePrecision< P >, BVH::DefaultBranchingRatio< CSGDetail::PrimitivePrecision< P > >(), SmoothMinOp< CSGDetail::PrimitivePrecision< P > >, P, Ps... >

A smooth union of the given arrays' types with the default blend.

Template Parameters
PFirst primitive type.
PsThe others.
Parameters
[in]a_poolPool.
[in]a_smoothLenSmoothing length.
[in]a_firstThe first type's primitives.
[in]a_primitivesThe other types' primitives.

◆ BVHUnion() [1/4]

template<class P , class... Ps>
EBGeometry::BVHUnion ( Pool &  a_pool,
const BVH::BuildSettings &  a_settings,
const std::vector< P > &  a_first,
const std::vector< Ps > &...  a_primitives 
) -> BVHUnion< CSGDetail::PrimitivePrecision< P >, BVH::DefaultBranchingRatio< CSGDetail::PrimitivePrecision< P > >(), P, Ps... >

A union of the given arrays' types, built with settings.

Template Parameters
PFirst primitive type.
PsThe others.
Parameters
[in]a_poolPool.
[in]a_settingsConstruction method and leaf sizes.
[in]a_firstThe first type's primitives.
[in]a_primitivesThe other types' primitives.

◆ BVHUnion() [2/4]

template<class P , class B , std::enable_if_t< CSGDetail::isBox< B >, int > = 0>
EBGeometry::BVHUnion ( Pool &  a_pool,
const std::vector< P > &  a_first,
const std::vector< B > &  a_boxes 
) -> BVHUnion< CSGDetail::PrimitivePrecision< P >, BVH::DefaultBranchingRatio< CSGDetail::PrimitivePrecision< P > >(), P >

A union of one type with the caller's boxes.

Template Parameters
PPrimitive type.
BBox type.
Parameters
[in]a_poolPool.
[in]a_firstThe first type's primitives.
[in]a_boxesThe primitives' boxes.

◆ BVHUnion() [3/4]

template<class P , class B , class... Rest, std::enable_if_t< CSGDetail::isBox< B >, int > = 0>
EBGeometry::BVHUnion ( Pool &  a_pool,
const std::vector< P > &  a_first,
const std::vector< B > &  a_boxes,
BVH::Construction  a_construction,
const Rest &...  a_rest 
) -> BVHUnion< CSGDetail::PrimitivePrecision< P >, BVH::DefaultBranchingRatio< CSGDetail::PrimitivePrecision< P > >(), P >

A union of one type with the caller's boxes and a construction method.

Template Parameters
PPrimitive type.
BBox type.
Parameters
[in]a_poolPool.
[in]a_firstThe first type's primitives.
[in]a_boxesThe primitives' boxes.
[in]a_constructionConstruction method.
[in]a_restThe leaf sizes (and for a smooth union, the construction method), if given.

◆ BVHUnion() [4/4]

template<class P , class... Ps, std::enable_if_t<!(CSGDetail::isBox< Ps >||...), int > = 0>
EBGeometry::BVHUnion ( Pool &  a_pool,
const std::vector< P > &  a_first,
const std::vector< Ps > &...  a_primitives 
) -> BVHUnion< CSGDetail::PrimitivePrecision< P >, BVH::DefaultBranchingRatio< CSGDetail::PrimitivePrecision< P > >(), P, Ps... >

A union of the given arrays' types, of the first type's precision and the default branching factor.

Template Parameters
PFirst primitive type.
PsThe others (none a box, which a one-type union's array of boxes is).
Parameters
[in]a_poolPool.
[in]a_firstThe first type's primitives.
[in]a_primitivesThe other types' primitives.

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

◆ closestSurface()

template<class T , class S >
SurfaceRef< T > EBGeometry::closestSurface ( const S &  a_shape,
const Vec3T< T > &  a_point 
)
inlinenoexcept

The surface of any shape that decides its value at a point: a container's closestSurface() (a tape, a BVH union, a sphere cloud), and for any other shape surface 0 with its part (see hasParts). For code templated on a shape. Callable on a device.

Template Parameters
TFloating-point precision.
SShape type.
Parameters
[in]a_shapeThe shape.
[in]a_pointQuery point, in the shape's frame.
Returns
The surface.

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

◆ connectedComponents() [1/3]

template<class T , class... UserPrimitives>
ConnectedComponents< T > EBGeometry::connectedComponents ( const Domain< T, UserPrimitives... > &  a_domain,
const ComponentOptions< T > &  a_options 
)

The connected components of a domain's subdomains, and of the regions it excludes: group s is subdomain s, group getNumSubdomainFunctions() - 1 the excluded regions (Domain::Excluded).

As connectedComponents(tape, groupOf, options), with each region's subdomain as its group. The tables pool must be readable on the host.

Template Parameters
TFloating-point precision.
UserPrimitivesThe tape's user primitives and features.
Parameters
[in]a_domainThe domain.
[in]a_optionsThe resolution and the box.
Returns
The components.

◆ connectedComponents() [2/3]

template<class T , class... UserPrimitives>
ConnectedComponents< T > EBGeometry::connectedComponents ( const Tape< T, UserPrimitives... > &  a_tape,
const ComponentOptions< T > &  a_options 
)

The connected components of every region of a tape, the outside (region 0) included: its enclosed cavities, and the separate bodies of a region.

Searches the box with an adaptive octree. A cell where one region's function is below minus the cell's half-diagonal lies wholly in that region (the functions are distance bounds), and is kept whole; every other cell is refined, down to cells of size h, each in the region of its center. Cells of the same region that share a face are joined into components. Exact for a model whose features are all much larger than h; see ComponentOptions::m_resolution for what h may merge or miss. The cost grows with the area of the surfaces over h squared. Aborts with a message, in every build, for a tape whose value is not a distance (DistanceQuality:: NotADistance), for a resolution that is not positive, for an empty or unbounded box (the tape's own, when no box is given), for a box more than 2^19 cells long, and when the search reaches ComponentOptions::m_maxCells cells. Host only; the tape's pool must be readable on the host.

Template Parameters
TFloating-point precision.
UserPrimitivesThe tape's user primitives and features.
Parameters
[in]a_tapeThe tape.
[in]a_optionsThe resolution and the box.
Returns
The components; their groups are the regions.

◆ connectedComponents() [3/3]

template<class T , class... UserPrimitives>
ConnectedComponents< T > EBGeometry::connectedComponents ( const Tape< T, UserPrimitives... > &  a_tape,
const std::vector< uint32_t > &  a_groupOf,
const ComponentOptions< T > &  a_options 
)

The connected components of groups of a tape's regions: regions of one group that touch form one component (materials: a_groupOf[r] the material of region r, say).

As connectedComponents(tape, options), the cells of regions of one group joined. Aborts with a message, in every build, when a_groupOf does not give one group per region.

Template Parameters
TFloating-point precision.
UserPrimitivesThe tape's user primitives and features.
Parameters
[in]a_tapeThe tape.
[in]a_groupOfEach region's group, one per region of the tape.
[in]a_optionsThe resolution and the box.
Returns
The components; their groups are those given.

◆ coverageOf() [1/2]

PieceCoverage EBGeometry::coverageOf ( const PossiblePiece &  a_piece,
const SurfaceInventory &  a_inventory,
const DomainSetup &  a_setup 
)
inline

How a domain's surface groups cover a piece an object may have: exactly, part by part when its selectors tell parts apart.

Host only. A piece is checked once when no selector depends on the part (a part, or a label that differs between parts); otherwise every part of its shape is (a mesh's faces: one check each). A member of a collection has parts the inventory does not count: it is checked once, as a part no part condition matches, so only selectors without one cover it. For a piece found, the overload taking its parts judges only those.

Parameters
[in]a_pieceThe piece.
[in]a_inventoryThe object's surfaces.
[in]a_setupThe domain whose surface groups cover it (its setup).
Returns
The coverage.

◆ coverageOf() [2/2]

PieceCoverage EBGeometry::coverageOf ( const PossiblePiece &  a_piece,
const SurfaceInventory &  a_inventory,
const DomainSetup &  a_setup,
const std::vector< uint32_t > &  a_parts 
)
inline

How a domain's surface groups cover a piece an object may have, judged on the parts of it found (a SurfacePiece's m_parts): a shape's parts need not all lie between the piece's two regions (a channel's side against the solid it is bored through, its caps against the outside), and a part that does not cannot be in a group there.

Host only. As coverageOf(const PossiblePiece&, const SurfaceInventory&, const DomainSetup&), but when its selectors tell parts apart, only the listed parts are checked; an empty list, or one naming none of the shape's parts, checks every part.

Parameters
[in]a_pieceThe piece.
[in]a_inventoryThe object's surfaces.
[in]a_setupThe domain whose surface groups cover it (its setup).
[in]a_partsThe parts of it found between its two regions (findSurfacePieces()).
Returns
The coverage.

◆ 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,
Accelerate  a_accelerate = Accelerate::None 
)
inline

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

The objects subtracted are one Union(), through a BVH with Accelerate::BVH.

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_accelerateWhether the tape evaluates the union of a_others through a BVH.
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.

◆ findSurfacePieces()

template<class TapeType >
std::vector< SurfacePiece< ShapePrecision< TapeType > > > EBGeometry::findSurfacePieces ( const TapeType &  a_tape,
const uint32_t  a_resolution = 64 
)

The pieces of surface an object with regions has, as rays find them: every surface between every pair of regions they cross, each once, in the order first found.

Host only. Rays along x, y and z on a grid over the tape's box, a_resolution by a_resolution of each, cross the object, and every change of region they meet (Tape::firstRegionChange(), exact where the shapes have ray forms) is a crossing of a piece; crossings of the same surface between the same two regions, whichever way and through whichever part, are one piece. The grid is offset by an irrational fraction of a cell, so that faces aligned with the axes are not grazed. Every piece found is real; a piece no ray crosses (smaller than a cell, or thinner than one along all three axes) is missed, so the pieces an object may have are possiblePieces(), and these confirm which of them it has. The cost is 3 a_resolution^2 rays.

Template Parameters
TapeTypeA Tape.
Parameters
[in]a_tapeThe tape.
[in]a_resolutionRays per side of the grid along each axis.
Returns
The pieces.

◆ 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. For now the copies are one surface: Tape::closestSurface() reports the leaf they copy, whichever copy decides. A copy that needs an identity of its own is placed as an object of its own, in a union (with Accelerate::BVH for many).

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.

◆ firstCrossing() [1/2]

template<class T , class S >
CrossingT< T > EBGeometry::firstCrossing ( 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, as firstHit() finds it, without the normal or the primitive there.

For a caller that needs only where the ray crosses: it skips what firstHit() spends on the normal and the primitive after finding the crossing (for a marched shape, the gradient and a search; for a tape or a fused composition, a second trace of the leaf it crossed). Searches [a_tMin, a_tMax] as firstHit() does, and finds the same crossing. 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.

◆ firstCrossing() [2/2]

template<class T , class S >
CrossingT< T > EBGeometry::firstCrossing ( 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, without the normal or the primitive there.

The ray from a_from towards a_to, over [a_tMin, |a_to - a_from|]: CrossingT::m_t is the distance from a_from, as for the segment firstHit(). 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.

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

◆ firstSurface() [1/2]

template<class T , class S >
SurfaceHitT< T > EBGeometry::firstSurface ( 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

A ray's first crossing of a shape's surface, and the surface it crossed: the ray counterpart of closestSurface(), as firstHit() is of signedDistance().

firstHit(), then, for a hit only, closestSurface() at the crossing: a collection (a tape's leaf, a BVH union, a sphere cloud) is drilled down to the member crossed, with its part and label. A miss costs what firstHit() costs; a hit, one more evaluation at the crossing. 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 and its surface, a miss, or an unresolved query.

◆ firstSurface() [2/2]

template<class T , class S >
SurfaceHitT< T > EBGeometry::firstSurface ( 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, and the surface crossed (see firstSurface() for a ray, and firstHit() for the segment).

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 and its surface, 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.

◆ MaterialLabel()

template<class A >
Expr< ExprPrecision< A > > EBGeometry::MaterialLabel ( const A &  a_operand,
std::string  a_name 
)
inline

Name the material of a region: an operand of an Overlay, a whole Overlay nested in another (a default for its regions without one of their own), or a whole object.

Materials are not surface labels (SurfaceLabel()): a material belongs to a volume, a surface label to surfaces. ExprIndex numbers the material names, in the order they first appear, depth first, as MaterialLabelId. A material label on part of a solid (an operand of a Union, an Intersection, ...) aborts with a message, in every build: a solid is one material; make the parts regions of an Overlay. Labeling an object that already has a material replaces it.

Template Parameters
AShape or Expr type.
Parameters
[in]a_operandObject.
[in]a_nameName (not empty).
Returns
The labeled object.

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

◆ Overlay() [1/4]

template<class A , class B , class... Rest>
Expr< ExprPrecision< A > > EBGeometry::Overlay ( const A &  a_first,
const B &  a_second,
const Rest &...  a_rest 
)
inline

Regions by priority, of two or more operands, each on top of the ones before it (see Overlay()).

Template Parameters
AShape or Expr type.
BShape or Expr type of the same precision.
RestShape or Expr types of the same precision.
Parameters
[in]a_firstThe first region, at the bottom.
[in]a_secondThe second region, on top of the first.
[in]a_restFurther regions, each on top of the ones before it.
Returns
The partition.

◆ Overlay() [2/4]

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

Regions by priority, a priority union: each operand is a region of its own, later operands on top of earlier ones where they overlap; the outside, region 0, is the background.

Region k is the part of operand k that no later operand covers, so the regions tile the object, with no gaps and no overlaps, by construction. Each region can have a material (MaterialLabel() on its operand). The background is what lies beyond the object and has no material: a medium around an object (the air around a cable) is a region of its own, an operand under the others, whose outer surface bounds the computational domain. A Tape evaluates an Overlay as the union of its operands, the whole object, so signedDistance() is unchanged by it; ExprIndex lists its regions, groups and materials.

Where an Overlay may appear: at the top of the expression, under maps (Translate, Rotate, ...), as the first operand of an Intersection or Difference whose other operands are plain solids (masks: they clip or drill every region), and as an operand of another Overlay, where its operands take its place in the outer priority order (it is kept as a group of regions). Anything else (a union with a solid or another Overlay, an offset, a blend, a repetition of an Overlay) aborts with a message, in every build: it would not be clear which region a result belongs to.

Template Parameters
AShape or Expr type.
Parameters
[in]a_operandsThe regions, in priority order (must not be empty).
Returns
The partition.

◆ Overlay() [3/4]

Expr< double > EBGeometry::Overlay ( std::initializer_list< Expr< double > >  a_operands)
inline

Regions by priority, of a braced list of shapes and Exprs of any types, double precision: Overlay({air, jacket, CylinderSDF<double>(...)}) (see Overlay()).

Parameters
[in]a_operandsThe regions, in priority order (must not be empty).
Returns
The partition.

◆ Overlay() [4/4]

Expr< float > EBGeometry::Overlay ( std::initializer_list< Expr< float > >  a_operands)
inline

Regions by priority, of a braced list of shapes and Exprs of any types, single precision (see Overlay()).

Parameters
[in]a_operandsThe regions, in priority order (must not be empty).
Returns
The partition.

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

◆ possiblePieces()

std::vector< PossiblePiece > EBGeometry::possiblePieces ( const SurfaceInventory &  a_inventory)
inline

Every piece of surface an object may have: each surface between each pair of regions its index says it may separate. A superset: every piece the object has is listed (findSurfacePieces() confirms which), and some listed may not occur.

Parameters
[in]a_inventoryThe surfaces (SurfaceInventory of the expression's index).
Returns
The pieces, by surface, then by pair.

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

◆ RegionName()

template<class A >
Expr< ExprPrecision< A > > EBGeometry::RegionName ( const A &  a_operand,
std::string  a_name 
)
inline

Name a region: an operand of an Overlay ("fluid", "wall"), or a whole Overlay nested in another (its region group).

A region's name says which region it is, its material (MaterialLabel()) what it is made of: two regions of the same material have names of their own. ExprIndex gives the names (Region::m_name, RegionGroup::m_name) and finds a region by its name (findRegion()); names are unique among the regions, and among the region groups, or ExprIndex aborts with a message. A name on part of a solid aborts with a message, in every build, as a material label does. Naming a named object replaces its name.

Template Parameters
AShape or Expr type.
Parameters
[in]a_operandObject.
[in]a_nameName (not empty).
Returns
The named object.

◆ regionNeighborhood()

template<class T >
RegionNeighborhood< T > EBGeometry::regionNeighborhood ( const Expr< T > &  a_expr,
const std::vector< uint32_t > &  a_regions 
)

Some regions of an expression and their neighbors: the regions that may touch them, as a smaller expression.

Two regions are neighbors when their bounding boxes meet, touching faces and edges included: a region whose box meets the box of a region given is kept; every other operand of the Overlays is dropped (a nested Overlay left with none, whole). Maps and clipping intersections above the Overlays are kept. A box is a conservative stand-in for a region: it never drops a region that touches one given (so every surface of theirs keeps the regions on both of its sides), but it may keep one that does not, when their boxes meet while the regions do not (a region in the hollow of an L-shaped one, or whose box is cut away by later regions). A region's box is its operand's, carried up through the maps above it and clipped by the clipping intersections' boxes; boxes meet within a small tolerance relative to the regions given, for the rounding of the maps. A region with an unbounded box (a half-space, a complement) meets every region its box reaches, so it keeps them, or is kept by every region given. Regions in a FiniteRepetition are kept whole, with it. Host only.

Template Parameters
TFloating-point precision.
Parameters
[in]a_exprAn expression; one with no Overlay has one region, the whole object, and is its own neighborhood.
[in]a_regionsRegions of the expression (ExprIndex numbers), at least one; aborts with a message otherwise, in every build. The background (region 0) meets every region: with it, every region is kept.
Returns
The neighborhood.

◆ 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/3]

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/3]

template<class A >
Expr< ExprPrecision< A > > EBGeometry::SmoothUnion ( const std::vector< A > &  a_operands,
const ExprPrecision< A >  a_smooth,
const Accelerate  a_accelerate 
)
inline

Smooth union of any number of objects with the polynomial blend, through a BVH or as written.

Template Parameters
AShape or Expr type.
Parameters
[in]a_operandsObjects (must not be empty).
[in]a_smoothSmoothing length (> 0).
[in]a_accelerateWhether the tape evaluates the union through a BVH.
Returns
The smooth union.

◆ SmoothUnion() [3/3]

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,
const Accelerate  a_accelerate = Accelerate::None 
)
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 it through a BVH as for Union(); a ray marches it.

Template Parameters
AShape or Expr type.
Parameters
[in]a_operandsObjects (must not be empty).
[in]a_smoothSmoothing length (> 0).
[in]a_blendBlend kind.
[in]a_accelerateWhether the tape evaluates the union through a BVH.
Returns
The smooth union.

◆ SurfaceLabel() [1/2]

template<class A >
Expr< ExprPrecision< A > > EBGeometry::SurfaceLabel ( const A &  a_operand,
FaceGroups  a_groups 
)
inline

Name a shape's parts by group (see hasParts): each part in a group gets the label of the group's name, which wins over any label above it; a part in no group keeps those.

For a mesh read from a file, the groups are its face groups (PolygonSoup::getFaceGroups()): an OBJ file's g and o groups, or an ASCII STL file's named solids, so that a mesh's patches (inlet, outlet, wall) become labels. The names are numbered with every other label's (see SurfaceLabel()), in the order they first appear. The operand must be one shape, not a composition (label it before translating or combining it) nor a collection (a BVH union, a sphere cloud, a tape), with as many parts as the groups have faces; anything else aborts with a message, in every build. A Tape reports the label in SurfaceRef::m_surfaceLabel, from closestSurface() and firstSurface(), on the host and on a device.

Template Parameters
AShape or Expr type.
Parameters
[in]a_operandA shape with parts (a mesh SDF, a box, ...).
[in]a_groupsThe group of each part, and the groups' names.
Returns
The labeled shape.

◆ SurfaceLabel() [2/2]

template<class A >
Expr< ExprPrecision< A > > EBGeometry::SurfaceLabel ( const A &  a_operand,
std::string  a_name 
)
inline

Name an object: every leaf below it gets the label, unless a part of it has a label of its own.

Labels change nothing in how the object is evaluated; they say which surfaces belong together, for boundary conditions, per-surface data and picking. A Tape reports a leaf's label on the host and on a device (Tape::getSurfaceLabel()); ExprIndex holds the names and the expression's structure on the host. Labels are numbered from 0 in the order their names first appear, depth first, so the same expression gives the same numbers to both; several objects may share a name, and so a label. On a composition (a union, an intersection, an Overlay, ...) the label is a default: an operand labeled itself keeps its own. Labeling an object that already has a label, directly or through maps (a move does not make another object), replaces it, as MaterialLabel() and RegionName() do: the replaced name is gone, and gets no number unless another object has it.

Template Parameters
AShape or Expr type.
Parameters
[in]a_operandObject.
[in]a_nameName (not empty).
Returns
The labeled object.

◆ 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,
Accelerate  a_accelerate = Accelerate::None 
)
inline

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

With Accelerate::BVH, a Tape evaluates the union through a BVH over the objects' boxes; with Accelerate::None, as written, every object at every point (a large one prints a warning when the tape is built, see TapeOptions::m_largeUnionWarning). In the BVH, an object that is a shape, or a shape under maps (Translate, Rotate, Scale, ...), is evaluated directly at its leaf; any other object is a sub-program the leaf calls. 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; with operands that are not distances, only its sign means anything. A list of one object is that object, with no BVH.

Template Parameters
AShape or Expr type.
Parameters
[in]a_operandsObjects (must not be empty).
[in]a_accelerateWhether the tape evaluates the union through a BVH.
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.

◆ hasParts

template<class S , class T >
constexpr bool EBGeometry::hasParts = SurfaceDetail::HasParts<S, T>::value
inlineconstexpr

Whether a shape has several parts: it has uint32_t getNumParts() const (host) and uint32_t closestPart(const Vec3T<T>&) const (host and device), which reads the part from its own formula at a point in its frame: the term that decides the value there (a box's face, a cylinder's side or cap, a mesh's face). A part belongs to the shape, never to a composition of it: a face a difference cuts into two pieces is one part. A shape without them has one part, 0.

Template Parameters
SShape type.
TFloating-point precision.

◆ hasRegionVisibility

template<class S , class = void>
constexpr bool EBGeometry::hasRegionVisibility = false
inlineconstexpr

Whether a shape's regions are shown by region settings (RegionView): the primary template is false.

Template Parameters
SShape type.

◆ hasSurfaces

template<class S , class T >
constexpr bool EBGeometry::hasSurfaces = SurfaceDetail::HasSurfaces<S, T>::value
inlineconstexpr

Whether a shape holds several surfaces: it has uint32_t getNumSurfaces() const (host) and SurfaceRef<T> closestSurface(const Vec3T<T>&) const (host and device), which name its members.

Tape, BVHUnion, BVHSmoothUnion and SphereCloudBVH are containers. A user's shape becomes one by defining both; closestSurface() must then number its surfaces from 0 to getNumSurfaces() - 1, the same on every call, and set SurfaceRef::m_surface and m_localPoint. Every other shape is one surface.

Template Parameters
SShape type.
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). The box holds the solid: the value is not negative outside it (a BVH union skips a member whose box a query misses, and a renderer's cut does too); a shape with no bound returns an unbounded box.

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.