|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
How to ray trace a shape directly, instead of marching its signed distance. More...
#include <EBGeometry_Ray.hpp>
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):
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.
| S | Shape type. |