EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
EBGeometry::RayForm< S, class > Struct Template Reference

How to ray trace a shape directly, instead of marching its signed distance. More...

#include <EBGeometry_Ray.hpp>

Detailed Description

template<class S, class = void>
struct EBGeometry::RayForm< S, class >

How to ray trace a shape directly, instead of marching its signed distance.

The primary template is empty: a shape has no ray form, and the queries march it. A specialisation for a shape type S gives it one, through the functions it defines; they are found by their signatures, so one with a wrong signature is not used (static_assert(hasRayForm<S, T>) checks it):

template <class T>
struct EBGeometry::RayForm<MyShape<T>>
{
firstHit(const MyShape<T>& a_shape, const RayT<T>& a_ray, T a_tMin, T a_tMax, const RayOptions<T>& a_options) noexcept;
spans(const MyShape<T>& a_shape, const RayT<T>& a_ray, T a_tMin, T a_tMax, const RayOptions<T>& a_options,
bool a_firstOnly, RaySpansT<T>& a_spans) noexcept;
};
#define EBGEOMETRY_HOST_DEVICE
Mark a function as callable from both host and device code (no-op on host compilers).
Definition EBGeometry_GPU.hpp:80
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.
Where a ray first crosses a surface.
Definition EBGeometry_Ray.hpp:96
How to ray trace a shape directly, instead of marching its signed distance.
Definition EBGeometry_Ray.hpp:347
How a query marches, where a shape has no ray form.
Definition EBGeometry_Ray.hpp:155
Where a ray is inside an object over an interval [t0, t1]: its spans, in order, each from where it en...
Definition EBGeometry_Ray.hpp:248
A ray: the points origin + t * direction.
Definition EBGeometry_Ray.hpp:54

firstHit() makes the shape a ray form: it returns the first crossing in [a_tMin, a_tMax], entering or leaving, with every field of HitT filled in. The others are optional. spans() writes where the ray is inside the object over [a_tMin, a_tMax] (see RaySpansT), which is what an intersection, difference or complement of the shape with others needs to be traced exactly (the ends carry no normal: the composition calls firstHit() near the crossing it ends at for that); a_firstOnly says that only the first crossing is needed (the list may then stop after it, its horizon there). Without spans(), a composition finds the spans by calling firstHit() from one crossing to the next. intersects(), with firstHit()'s arguments and returning HitStatus, is a yes/no query that can stop at the first crossing it finds; without it, intersects() calls firstHit(). The second template parameter is for partial specialisations that depend on a condition.

Template Parameters
SShape type.

The documentation for this struct was generated from the following file: