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

Ray forms of smooth unions and intersections: traced exactly where they cannot differ from the plain operation, and marched only where they can. More...

#include <cmath>
#include <cstdint>
#include <type_traits>
#include <utility>
#include "EBGeometry_CSGRayForms.hpp"
#include "EBGeometry_Fused.hpp"
#include "EBGeometry_Math.hpp"
#include "EBGeometry_OffsetRayForms.hpp"
#include "EBGeometry_Ray.hpp"
#include "EBGeometry_RaySpans.hpp"
Include dependency graph for EBGeometry_SmoothRayForms.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  EBGeometry::RayDetail::MarchedView< S >
 A shape seen only through its value, with no ray form: what a smooth operation is marched as where it may differ from the plain operation. More...
 
struct  EBGeometry::RayDetail::IsComposition< MarchedView< S > >
 A marched view is called out of line on a device where its shape is. More...
 
struct  EBGeometry::RayDetail::BlendZoneView< T, Cs >
 A fused smooth union restricted to where it can differ from the plain union of its operands: the value max(u, m2 - w), u the smooth union's and m2 its second smallest operand's, w its blend length plus how far the blend deepens (s + s/4). A polynomial blend of length s changes the minimum only where the two smallest operands are within s of each other, and changes its sign only where the smallest is within s/4 of 0: both within w. Where this value is negative, the smooth union is inside; everywhere else it is inside exactly where the plain union is. More...
 
struct  EBGeometry::RayDetail::IsComposition< BlendZoneView< T, Cs... > >
 A blend zone view is called out of line on a device. More...
 
struct  EBGeometry::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...
 

Namespaces

namespace  EBGeometry
 Namespace containing all of EBGeometry's functionality.
 

Functions

template<class T >
T EBGeometry::RayDetail::blendDepth (const T a_smooth, const bool a_exponential) noexcept
 How far a smooth union's blend can deepen its operands' minimum: s/4 for the polynomial blend, s ln 2 for the exponential one.
 
template<class T , class Op , class... Cs, size_t... Is>
void EBGeometry::RayDetail::pairOverlaps (const Fused::Node< Op, Cs... > &a_node, const T a_grow, BoundingVolumes::AABBT< T > &a_box, bool &a_any, std::index_sequence< Is... >) noexcept
 Where two of a fused node's operands' boxes, grown by a_grow, overlap: the box of each pair's overlap, united into a_box (a_any says whether there is one yet).
 

Detailed Description

Ray forms of smooth unions and intersections: traced exactly where they cannot differ from the plain operation, and marched only where they can.

A smooth union with the polynomial blend of length s changes its operands' minimum only where the two smallest are within s of each other, and changes its sign only where the smallest is within s/4 of 0. So it is inside wherever the plain union is, and differs from it only in its blend zone, where the two smallest operands are both within w = s + s/4 of their surfaces. A ray traces the plain union exactly from its operands' spans, and marches the blend zone view (RayDetail::BlendZoneView) only inside the box where two operands' boxes, grown by w, overlap, and only up to what the plain union is known up to; the two are united. An exponential blend differs from the plain union everywhere and is marched whole. A smooth intersection only raises its operands' maximum, so it lies within their plain intersection, traced exactly, and is marched within its spans. The fused SmoothUnion, SmoothIntersection and SmoothDifference trace this way; a tape marches its smooth operations whole.

Author
Robert Marskar

Function Documentation

◆ blendDepth()

template<class T >
T EBGeometry::RayDetail::blendDepth ( const T  a_smooth,
const bool  a_exponential 
)
inlinenoexcept

How far a smooth union's blend can deepen its operands' minimum: s/4 for the polynomial blend, s ln 2 for the exponential one.

Internal helper; not part of the public API.

Template Parameters
TFloating-point precision.
Parameters
[in]a_smoothSmoothing length.
[in]a_exponentialWhether the blend is exponential.
Returns
The depth.

◆ pairOverlaps()

template<class T , class Op , class... Cs, size_t... Is>
void EBGeometry::RayDetail::pairOverlaps ( const Fused::Node< Op, Cs... > &  a_node,
const T  a_grow,
BoundingVolumes::AABBT< T > &  a_box,
bool &  a_any,
std::index_sequence< Is... >   
)
inlinenoexcept

Where two of a fused node's operands' boxes, grown by a_grow, overlap: the box of each pair's overlap, united into a_box (a_any says whether there is one yet).

Internal helper; not part of the public API.

Template Parameters
TFloating-point precision.
OpOperation.
CsOperand types.
IsOperand indices.
Parameters
[in]a_nodeThe node.
[in]a_growHow much each box is grown.
[in,out]a_boxThe box so far.
[in,out]a_anyWhether there is one.