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

The ray forms (see RayForm) of compositions: the fused union, intersection, difference, complement and affine maps (Fused::Node), and BVHUnion. Each traces its operands' spans along the ray (see EBGeometry_RaySpans.hpp) and combines them, so that a composition of shapes with ray forms is traced exactly; an operand without one is marched by itself, in its own box. The fused offset and annulus of a shape whose level sets have a closed form have their ray form in EBGeometry_OffsetRayForms.hpp. The other fused operations (smooth blends, offsets and annuli of anything else, elongation, repetition, blur, mollification) have no ray form, and are marched. Tape's ray form, which does the same clause by clause, is in EBGeometry_Tape.hpp. More...

#include <cstddef>
#include <cstdint>
#include <type_traits>
#include <utility>
#include "EBGeometry_AnalyticRayForms.hpp"
#include "EBGeometry_BVHUnion.hpp"
#include "EBGeometry_CSGOps.hpp"
#include "EBGeometry_Fused.hpp"
#include "EBGeometry_MeshRayForms.hpp"
#include "EBGeometry_Ray.hpp"
#include "EBGeometry_OffsetRayForms.hpp"
Include dependency graph for EBGeometry_CSGRayForms.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  EBGeometry::Fused::Detail::TracedExactly< Op >
 Whether a fused operation is traced exactly from its operands' spans: union, intersection (and so difference), complement and affine maps. More...
 
struct  EBGeometry::Fused::Detail::TracedExactly< CombineOp< IsUnion > >
 Union and intersection are traced exactly. More...
 
struct  EBGeometry::Fused::Detail::TracedExactly< ComplementOp >
 Complement is traced exactly. More...
 
struct  EBGeometry::Fused::Detail::TracedExactly< AffineOp< T > >
 Affine maps are traced exactly. More...
 
struct  EBGeometry::RayDetail::IsTracedFused< S >
 Whether a shape is a fused node traced from its operands' spans. More...
 
struct  EBGeometry::RayDetail::IsTracedFused< Fused::Node< Op, Cs... > >
 A fused node is, if its operation is traced exactly. More...
 
struct  EBGeometry::RayDetail::LeafCount< S >
 How many leaves a shape has, as a fused composition numbers the crossings of its operands: its operands' leaves for a traced fused node, and one for any other shape. More...
 
struct  EBGeometry::RayDetail::LeafCount< Fused::Node< Op, Cs... > >
 A fused node's leaves: its operands', one after another (one if it is not traced). More...
 
struct  EBGeometry::RayDetail::FirstLeaf< 0, C, Cs... >
 Operand 0's first leaf is leaf 0. More...
 
struct  EBGeometry::RayDetail::FirstLeaf< I, C, Cs... >
 Operand I's first leaf is past the first operand's leaves. More...
 
struct  EBGeometry::RayDetail::DeferredOperand< C, class >
 Whether an intersection traces a fused node's operand only within the spans of its other operands, though it has a ray form: one whose spans over a whole ray cost far more than its first crossings within them (a mesh's offset or annulus, see EBGeometry_OffsetRayForms.hpp, which specialises it). More...
 
struct  EBGeometry::RayDetail::MarchedOperand< C, T >
 Whether an intersection marches (or defers, see DeferredOperand) a fused node's operand, within the spans of its other operands: 1 for an operand without a ray form or deferred, 2 for the complement of one, 0 for any other. More...
 
struct  EBGeometry::RayDetail::MarchedOperand< Fused::Node< Fused::ComplementOp, D >, T >
 The complement of an operand without a ray form is marched. More...
 
struct  EBGeometry::RayDetail::FirstTraced< T, Cs >
 The first of a fused node's operands an intersection does not march, which it traces first: 0 if it marches all. More...
 
struct  EBGeometry::RayDetail::FirstTraced< T, C, Cs... >
 The first operand if it is not marched, and otherwise the first of the others that is not. More...
 
struct  EBGeometry::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  EBGeometry::RayForm< BVHUnion< T, P, K > >
 BVHUnion's ray form: the union of the spans of the primitives whose boxes the ray meets, found by walking the BVH nearest box first and leaving out the boxes beyond what the union so far is known up to. Exact where the primitive type has a ray form (and marched one primitive at a time otherwise), and callable on a device. More...
 

Namespaces

namespace  EBGeometry
 Namespace containing all of EBGeometry's functionality.
 
namespace  EBGeometry::Fused
 Fused CSG: the expression builder's operations as types (see EBGeometry_Fused.hpp).
 
namespace  EBGeometry::Fused::Detail
 Implementation details of the fused operations.
 

Functions

template<size_t I, class Op , class... Cs>
auto EBGeometry::RayDetail::fusedOperand (const Fused::Node< Op, Cs... > &a_node) noexcept
 Operand I of a fused node, as the shape it is.
 
template<size_t I, class T , class Op , class... Cs>
void EBGeometry::RayDetail::fusedOperandSpans (const Fused::Node< Op, Cs... > &a_node, const RayT< T > &a_ray, const T a_t0, const T a_t1, const RayOptions< T > &a_options, const bool a_firstOnly, RaySpansT< T > &a_spans) noexcept
 Operand I's list of a fused node, its crossings named among the node's leaves.
 
template<size_t I, class T , class Op , class... Cs>
void EBGeometry::RayDetail::fusedUnite (const Fused::Node< Op, Cs... > &a_node, const RayT< T > &a_ray, const T a_t0, const RayOptions< T > &a_options, const bool a_firstOnly, RaySpansT< T > &a_spans, RaySpansT< T > &a_operand) noexcept
 Unite a fused node's operands I, I + 1, ... into a list.
 
template<size_t I, bool Marched, size_t Skip, class T , class Op , class... Cs>
void EBGeometry::RayDetail::fusedIntersect (const Fused::Node< Op, Cs... > &a_node, const RayT< T > &a_ray, const T a_t0, const RayOptions< T > &a_options, const bool a_firstOnly, RaySpansT< T > &a_spans, RaySpansT< T > &a_operand, RaySpansT< T > &a_scratch) noexcept
 Intersect a fused node's operands I, I + 1, ... other than operand Skip into a list: those it traces, or (Marched) those it marches (see MarchedOperand).
 
template<size_t I, class T , class Op , class... Cs>
HitT< T > EBGeometry::RayDetail::fusedOperandLeafHit (const Fused::Node< Op, Cs... > &a_node, const RayT< T > &a_ray, const T a_t, const uint32_t a_leaf, const RayOptions< T > &a_options) noexcept
 The crossing at a distance along a ray on one of operand I's leaves of a fused node.
 
template<class T , class Op , class... Cs, size_t... Is>
HitT< T > EBGeometry::RayDetail::fusedLeafHit (const Fused::Node< Op, Cs... > &a_node, const RayT< T > &a_ray, const T a_t, const uint32_t a_leaf, const RayOptions< T > &a_options, std::index_sequence< Is... >) noexcept
 The crossing at a distance along a ray on a leaf of a fused node: in the operand holding the leaf.
 

Detailed Description

The ray forms (see RayForm) of compositions: the fused union, intersection, difference, complement and affine maps (Fused::Node), and BVHUnion. Each traces its operands' spans along the ray (see EBGeometry_RaySpans.hpp) and combines them, so that a composition of shapes with ray forms is traced exactly; an operand without one is marched by itself, in its own box. The fused offset and annulus of a shape whose level sets have a closed form have their ray form in EBGeometry_OffsetRayForms.hpp. The other fused operations (smooth blends, offsets and annuli of anything else, elongation, repetition, blur, mollification) have no ray form, and are marched. Tape's ray form, which does the same clause by clause, is in EBGeometry_Tape.hpp.

Author
Robert Marskar

Function Documentation

◆ fusedIntersect()

template<size_t I, bool Marched, size_t Skip, class T , class Op , class... Cs>
void EBGeometry::RayDetail::fusedIntersect ( const Fused::Node< Op, Cs... > &  a_node,
const RayT< T > &  a_ray,
const T  a_t0,
const RayOptions< T > &  a_options,
const bool  a_firstOnly,
RaySpansT< T > &  a_spans,
RaySpansT< T > &  a_operand,
RaySpansT< T > &  a_scratch 
)
inlinenoexcept

Intersect a fused node's operands I, I + 1, ... other than operand Skip into a list: those it traces, or (Marched) those it marches (see MarchedOperand).

Internal helper; not part of the public API. A traced operand is traced up to what the list so far is known up to; a marched one only within the list's spans (RayDetail::spansWithin()), and the complement of one is taken of its spans there, so the traced operands go first.

Template Parameters
IFirst operand to intersect.
MarchedWhether to intersect the marched operands (or the traced ones).
SkipThe operand the list started from.
TFloating-point precision.
OpOperation.
CsOperand types.
Parameters
[in]a_nodeThe node.
[in]a_rayThe ray.
[in]a_t0Start of the interval.
[in]a_optionsHow to march.
[in]a_firstOnlyWhether only the intersection's first crossing is needed.
[in,out]a_spansThe list so far.
[in,out]a_operandScratch for an operand's list.
[in,out]a_scratchScratch for an intersection.

◆ fusedLeafHit()

template<class T , class Op , class... Cs, size_t... Is>
HitT< T > EBGeometry::RayDetail::fusedLeafHit ( const Fused::Node< Op, Cs... > &  a_node,
const RayT< T > &  a_ray,
const T  a_t,
const uint32_t  a_leaf,
const RayOptions< T > &  a_options,
std::index_sequence< Is... >   
)
inlinenoexcept

The crossing at a distance along a ray on a leaf of a fused node: in the operand holding the leaf.

Internal helper; not part of the public API. A fold over the operands rather than a recursion, which nvcc can leave without device code.

Template Parameters
TFloating-point precision.
OpOperation.
CsOperand types.
IsOperand indices.
Parameters
[in]a_nodeThe node.
[in]a_rayThe ray.
[in]a_tThe crossing's distance.
[in]a_leafThe leaf, among the node's.
[in]a_optionsHow to march.
Returns
The crossing on the leaf.

◆ fusedOperand()

template<size_t I, class Op , class... Cs>
auto EBGeometry::RayDetail::fusedOperand ( const Fused::Node< Op, Cs... > &  a_node)
inlinenoexcept

Operand I of a fused node, as the shape it is.

Internal helper; not part of the public API.

Template Parameters
IOperand index.
OpOperation.
CsOperand types.
Parameters
[in]a_nodeThe node.
Returns
The operand.

◆ fusedOperandLeafHit()

template<size_t I, class T , class Op , class... Cs>
HitT< T > EBGeometry::RayDetail::fusedOperandLeafHit ( const Fused::Node< Op, Cs... > &  a_node,
const RayT< T > &  a_ray,
const T  a_t,
const uint32_t  a_leaf,
const RayOptions< T > &  a_options 
)
inlinenoexcept

The crossing at a distance along a ray on one of operand I's leaves of a fused node.

Internal helper; not part of the public API.

Template Parameters
IOperand index.
TFloating-point precision.
OpOperation.
CsOperand types.
Parameters
[in]a_nodeThe node.
[in]a_rayThe ray.
[in]a_tThe crossing's distance.
[in]a_leafThe leaf, among the node's.
[in]a_optionsHow to march.
Returns
The crossing on the leaf.

◆ fusedOperandSpans()

template<size_t I, class T , class Op , class... Cs>
void EBGeometry::RayDetail::fusedOperandSpans ( const Fused::Node< Op, Cs... > &  a_node,
const RayT< T > &  a_ray,
const T  a_t0,
const T  a_t1,
const RayOptions< T > &  a_options,
const bool  a_firstOnly,
RaySpansT< T > &  a_spans 
)
inlinenoexcept

Operand I's list of a fused node, its crossings named among the node's leaves.

Internal helper; not part of the public API.

Template Parameters
IOperand index.
TFloating-point precision.
OpOperation.
CsOperand types.
Parameters
[in]a_nodeThe node.
[in]a_rayThe ray.
[in]a_t0Start of the interval.
[in]a_t1End of the interval.
[in]a_optionsHow to march.
[in]a_firstOnlyWhether only the first crossing is needed.
[out]a_spansThe list.

◆ fusedUnite()

template<size_t I, class T , class Op , class... Cs>
void EBGeometry::RayDetail::fusedUnite ( const Fused::Node< Op, Cs... > &  a_node,
const RayT< T > &  a_ray,
const T  a_t0,
const RayOptions< T > &  a_options,
const bool  a_firstOnly,
RaySpansT< T > &  a_spans,
RaySpansT< T > &  a_operand 
)
inlinenoexcept

Unite a fused node's operands I, I + 1, ... into a list.

Internal helper; not part of the public API. Each operand is traced only up to what the list so far is known up to, beyond which it can change nothing known.

Template Parameters
IFirst operand to unite.
TFloating-point precision.
OpOperation.
CsOperand types.
Parameters
[in]a_nodeThe node.
[in]a_rayThe ray.
[in]a_t0Start of the interval.
[in]a_optionsHow to march.
[in]a_firstOnlyWhether the operands need only their first crossings.
[in,out]a_spansThe list so far.
[in,out]a_operandScratch for an operand's list.