|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
Declaration of Tape, a composed object (an Expr) compiled into a pool, and its evaluator. More...
#include <cstddef>#include <cstdint>#include <tuple>#include <type_traits>#include <vector>#include "EBGeometry_AnalyticDistanceFunctions.hpp"#include "EBGeometry_BVHUnion.hpp"#include "EBGeometry_BoundingVolumes.hpp"#include "EBGeometry_CSGRayForms.hpp"#include "EBGeometry_DistanceQuality.hpp"#include "EBGeometry_Expr.hpp"#include "EBGeometry_GPU.hpp"#include "EBGeometry_MeshDistanceFunctions.hpp"#include "EBGeometry_OffsetRayForms.hpp"#include "EBGeometry_PODVector.hpp"#include "EBGeometry_PackedBVH.hpp"#include "EBGeometry_Pool.hpp"#include "EBGeometry_PrimitiveRef.hpp"#include "EBGeometry_Ray.hpp"#include "EBGeometry_Vec.hpp"#include "EBGeometry_TapeImplem.hpp"

Go to the source code of this file.
Classes | |
| struct | EBGeometry::TapeOptions |
| Settings for compiling an Expr into a Tape. More... | |
| struct | EBGeometry::TapeFeature::Tag |
| Base of every feature: a Tape template argument derived from it is a feature, not a primitive type. More... | |
| struct | EBGeometry::TapeFeature::ExactOffsets |
| Ray queries trace an Offset or Annular of a primitive with closed-form level sets (or of an affine map of one) exactly, from its level sets (see RayDetail::LevelForm); without it they march it. The level passes through Scale, Translate and Rotate to the primitive, divided by the map's value scale, so an annulus of a scaled mesh is still traced exactly. More... | |
| struct | EBGeometry::TapeDetail::RayClause |
| One ray program clause. More... | |
| struct | EBGeometry::TapeDetail::Clause |
| One tape clause. More... | |
| struct | EBGeometry::TapeDetail::Program |
| A sub-program: a range of clauses. More... | |
| struct | EBGeometry::TapeDetail::UnionBVH< T, K > |
| A BVH union's two parts, as layouts in the tape's pool: a BVH over the sub-programs with bounded boxes, and a single leaf (or nothing) holding those with unbounded ones. More... | |
| struct | EBGeometry::TapeDetail::TypeList< Ps > |
| A list of types. More... | |
| struct | EBGeometry::TapeDetail::TypeAt< I, TypeList< Ps... > > |
| The I-th type of a TypeList. More... | |
| struct | EBGeometry::TapeDetail::IndexOf< P, TypeList<> > |
| P is not in the empty list. More... | |
| struct | EBGeometry::TapeDetail::IndexOf< P, TypeList< Q, Rest... > > |
| The index of P in a non-empty list. More... | |
| struct | EBGeometry::TapeDetail::Concat< Lists > |
| The concatenation of TypeLists. More... | |
| struct | EBGeometry::TapeDetail::Concat< TypeList< Ps... >, Rest... > |
| The concatenation of TypeLists. More... | |
| struct | EBGeometry::TapeDetail::Concat< TypeList< Ps... >, TypeList< Qs... > > |
| The concatenation of two TypeLists. More... | |
| struct | EBGeometry::TapeDetail::PrimitiveStore< Ps > |
| One pool array per primitive type, holding the type's stored form (CSGDetail::Stored). More... | |
| struct | EBGeometry::TapeDetail::PrimitiveStore< P, Ps... > |
| One pool array per primitive type: the first type's, then the rest. More... | |
| struct | EBGeometry::TapeDetail::StoreOf< TypeList< Ps... > > |
| The PrimitiveStore for the types of a TypeList. More... | |
| struct | EBGeometry::TapeDetail::UserTypes< T, TypeList< Ps... > > |
| Whether a tape's user primitive types are shapes of its precision. More... | |
| class | EBGeometry::Tape< T, UserPrimitives > |
| 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 | EBGeometry::Tape< T, UserPrimitives >::Layout |
| The tape's arrays as offsets into its pool, with no location (see PoolHandle). More... | |
| struct | EBGeometry::RayForm< Tape< T, UserPrimitives... > > |
| Tape's ray form: the tape traced along its ray program (see Tape::firstHit()). Callable on a device. More... | |
Namespaces | |
| namespace | EBGeometry |
| Namespace containing all of EBGeometry's functionality. | |
| namespace | EBGeometry::TapeFeature |
| Optional tape features, listed among a Tape's template arguments: Tape<T, TapeFeature::ExactOffsets>. | |
Typedefs | |
| template<class... Args> | |
| using | EBGeometry::TapeDetail::FeaturesOf = typename Concat< std::conditional_t< IsFeature< Args >, TypeList< Args >, TypeList<> >... >::type |
| The features among a Tape's template arguments. | |
| template<class... Args> | |
| using | EBGeometry::TapeDetail::UserTypesOf = typename Concat< std::conditional_t< IsFeature< Args >, TypeList<>, TypeList< Args > >... >::type |
| The user primitive types among a Tape's template arguments: those that are not features. | |
| template<class T , class... UserPrimitives> | |
| using | EBGeometry::TapeDetail::Primitives = typename Concat< TypeList< PlaneSDF< T >, SphereSDF< T >, BoxSDF< T >, TorusSDF< T >, CylinderSDF< T >, InfiniteCylinderSDF< T >, CapsuleSDF< T >, InfiniteConeSDF< T >, ConeSDF< T >, RoundedBoxSDF< T >, RoundedCylinderSDF< T >, PerlinSDF< T >, FlatMeshSDF< T >, MeshSDF< T, BVH::DefaultBranchingRatio< T >()>, TriMeshSDF< T, BVH::DefaultBranchingRatio< T >(), TriangleSoA::DefaultWidth< T >()> >, UserTypesOf< UserPrimitives... > >::type |
| The tape's primitive types: the twelve analytic shapes, the three mesh SDFs with the default branching factor and SIMD width, then the user's types (its template arguments that are not features). | |
Enumerations | |
| enum class | EBGeometry::TapeDetail::Op : uint8_t { Primitive , PushAffine , PushElongate , PopPoint , Negate , Abs , AddConstant , MulConstant , Min , Max , PairInit , PairInsert , PairBlend , Blur , Mollify , Repeat , UnionBVH , SmoothUnionBVH } |
| The tape's operations. More... | |
| enum class | EBGeometry::TapeDetail::RayOp : uint8_t { Leaf , Marched , Union , Intersection , Complement , PushAffine , PopAffine , UnionBVH } |
| The operations of a ray program. More... | |
Functions | |
| Clause | EBGeometry::TapeDetail::stored (const RayClause &a_clause) noexcept |
| A ray program clause, stored in the clause array (the two have the same fields). | |
| RayClause | EBGeometry::TapeDetail::rayClause (const Clause &a_clause) noexcept |
| The ray program clause a stored clause is. | |
| template<size_t I, class P , class... Ps> | |
| const auto & | EBGeometry::TapeDetail::storeAt (const PrimitiveStore< P, Ps... > &a_store) noexcept |
| The pool array of the I-th primitive type. | |
| template<size_t I, class P , class... Ps> | |
| auto & | EBGeometry::TapeDetail::storeAt (PrimitiveStore< P, Ps... > &a_store) noexcept |
| The pool array of the I-th primitive type. | |
Variables | |
| template<class A > | |
| constexpr bool | EBGeometry::TapeDetail::IsFeature = std::is_base_of_v<TapeFeature::Tag, A> |
| Whether a Tape template argument is a feature (see TapeFeature). | |
Declaration of Tape, a composed object (an Expr) compiled into a pool, and its evaluator.
A Tape stores its shapes in one array per shape type and its operations as a list of clauses that refer to them by type and index, so evaluating it calls no virtual function and follows no pointer. It is a pool handle (see PoolHandle): trivially copyable, and evaluated against whichever mirror of its pool it is rebased onto. The evaluator keeps to the device subset (no recursion, no function pointers, no exceptions); operations that evaluate a subtree several times (Blur, Mollify, FiniteRepetition and BVH-accelerated unions) call a sub-program through a call-depth template, so nesting is bounded at compile time.
Beside the clauses, the compiler writes a ray program for the tape and for each BVH union operand: the expression's unions, intersections, complements and affine maps over the primitives that have ray forms, in the same order, which Tape's ray form follows to trace the tape exactly along a ray (see EBGeometry_RaySpans.hpp). A subtree with anything else in it is marched as a whole, through its clauses. The evaluator does not read the ray programs.
| using EBGeometry::TapeDetail::FeaturesOf = typedef typename Concat<std::conditional_t<IsFeature<Args>, TypeList<Args>, TypeList<> >...>::type |
The features among a Tape's template arguments.
Internal helper; not part of the public API.
| Args | Template arguments after T. |
| using EBGeometry::TapeDetail::Primitives = typedef typename Concat<TypeList<PlaneSDF<T>, SphereSDF<T>, BoxSDF<T>, TorusSDF<T>, CylinderSDF<T>, InfiniteCylinderSDF<T>, CapsuleSDF<T>, InfiniteConeSDF<T>, ConeSDF<T>, RoundedBoxSDF<T>, RoundedCylinderSDF<T>, PerlinSDF<T>, FlatMeshSDF<T>, MeshSDF<T, BVH::DefaultBranchingRatio<T>()>, TriMeshSDF<T, BVH::DefaultBranchingRatio<T>(), TriangleSoA::DefaultWidth<T>()> >, UserTypesOf<UserPrimitives...> >::type |
The tape's primitive types: the twelve analytic shapes, the three mesh SDFs with the default branching factor and SIMD width, then the user's types (its template arguments that are not features).
Internal helper; not part of the public API.
| T | Floating-point precision. |
| UserPrimitives | User primitive types and features. |
| using EBGeometry::TapeDetail::UserTypesOf = typedef typename Concat<std::conditional_t<IsFeature<Args>, TypeList<>, TypeList<Args> >...>::type |
The user primitive types among a Tape's template arguments: those that are not features.
Internal helper; not part of the public API.
| Args | Template arguments after T. |
|
strong |
The tape's operations.
Internal helper; not part of the public API. A sub-program runs its clauses in order on a stack of values and a stack of points; its input point is on the point stack when it starts, and its value is the one value left when it ends.
| Enumerator | |
|---|---|
| Primitive | Push the value of primitive (m_type, m_a) at the top point. |
| PushAffine | Push the top point mapped by the affine map at params[m_a..m_a+12). |
| PushElongate | Push p - clamp(p, -h, h), h at params[m_a..m_a+3). |
| PopPoint | Pop a point. |
| Negate | v -> -v. |
| Abs | v -> |v|. |
| AddConstant | v -> v + params[m_a]. |
| MulConstant | v -> v * params[m_a]. |
| Min | Pop b and a, push min(a, b). |
| Max | Pop b and a, push max(a, b). |
| PairInit | Push the empty pair of extreme values (+inf, +inf), or (-inf, -inf) if m_flags is 1. |
| PairInsert | Pop v and insert it into the pair below: the two smallest, or largest if m_flags is 1. |
| PairBlend | Pop the pair and push its smooth min (or max if bit 0 of m_flags is set), with the exponential blend if bit 1 is set; smoothing length params[m_a]. |
| Blur | Push the 27-tap blur of sub-program m_a; distance and weights at params[m_b..m_b+5). |
| Mollify | Push sum_k w_k f(p - o_k) over m_c taps of sub-program m_a; (o_k, w_k) at params[m_b..). |
| Repeat | Push the minimum over the copies of sub-program m_a (CSGOps::repetition()); period, low and high counts and the object's box at params[m_b..m_b+15). |
| UnionBVH | Push the minimum over the sub-programs in BVH union m_a. |
| SmoothUnionBVH | Push the smooth minimum of the two smallest sub-programs in BVH union m_a; smoothing length params[m_b], exponential blend if m_flags is 1. |
|
strong |
The operations of a ray program.
Internal helper; not part of the public API. A ray program runs its clauses in order on a stack of span lists (RaySpansT) and a stack of rays; its ray is on the ray stack when it starts, and its list is the one list left when it ends. Bit 0 of a clause's m_flags says that all its spans are needed, not only its first crossing.
| Enumerator | |
|---|---|
| Leaf | Push the spans of primitive (m_type, m_a), leaf number m_b, along the top ray. With bit 3 of m_flags, of its level set at params[m_c] (an Offset of it, see RayDetail::LevelView); with bit 4 as well, of its annulus of that half-thickness (see rayLevelLeaf()). |
| Marched | Push the spans of sub-program m_a along the top ray, marched in the box at params[m_b..m_b+6), with distance quality m_c. With bit 1 of m_flags, it is an operand of an intersection, marched only within the spans of the top list, the operands' before it (see RayDetail::spansWithin()); with bit 2 as well, the intersection needs only its first crossing. With bit 3, it is instead a mesh's level set deferred in an intersection (see RayDetail::DeferredOperand): primitive (m_type, m_a), leaf number m_c, the level at params[m_b] (an annulus with bit 4), and with bit 5 the affine map it is traced through at params[m_b+1..m_b+13) (see rayLevelWithin()). |
| Union | Pop two lists and push their union. |
| Intersection | Pop two lists and push their intersection. |
| Complement | Replace the top list by its complement. |
| PushAffine | Push the top ray mapped by the affine map at params[m_a..m_a+12). |
| PopAffine | Pop a ray, and map the top list back through the map at params[m_a..m_a+12). |
| UnionBVH | Push the union of the spans of the sub-programs in BVH union m_a; its operands, with the sub-programs they call, are sub-programs m_b up to m_c. |
|
inlinenoexcept |
The ray program clause a stored clause is.
Internal helper; not part of the public API.
| [in] | a_clause | Stored clause. |
|
inlinenoexcept |
The pool array of the I-th primitive type.
Internal helper; not part of the public API.
| I | Type index. |
| P | First primitive type. |
| Ps | Remaining primitive types. |
| [in] | a_store | Store. |
|
inlinenoexcept |
The pool array of the I-th primitive type.
Internal helper; not part of the public API.
| I | Type index. |
| P | First primitive type. |
| Ps | Remaining primitive types. |
| [in,out] | a_store | Store. |
|
inlinenoexcept |
A ray program clause, stored in the clause array (the two have the same fields).
Internal helper; not part of the public API.
| [in] | a_clause | Ray program clause. |
|
inlineconstexpr |
Whether a Tape template argument is a feature (see TapeFeature).
Internal helper; not part of the public API.
| A | Template argument. |