29#ifndef EBGEOMETRY_RAY_HPP
30#define EBGEOMETRY_RAY_HPP
77 at(T a_t)
const noexcept;
163 T m_tolerance = T(1e-4);
173 uint32_t m_maxSteps = 512;
185 bool m_march =
false;
252 static constexpr uint32_t Capacity = 8;
278 uint32_t m_count = 0;
345template <
class S,
class =
void>
365template <
class T,
class S>
388template <class T, class S>
391firstHit(const S& a_shape,
392 const
Vec3T<T>& a_from,
393 const
Vec3T<T>& a_to,
410template <class T, class S>
413intersects(const S& a_shape,
414 const
RayT<T>& a_ray,
415 typename
RayT<T>::Scalar a_tMin,
416 typename
RayT<T>::Scalar a_tMax,
433template <class T, class S>
436intersects(const S& a_shape,
437 const
Vec3T<T>& a_from,
438 const
Vec3T<T>& a_to,
444#include "EBGeometry_RayImplem.hpp"
Declarations of bounding volume types used in bounding volume hierarchies.
How far a function's value can be trusted as a distance: DistanceQuality, and the distanceQualityOf t...
GPU portability layer: host/device decoration macros and backend detection.
#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
Scalar helpers and numeric limits that compile for both host and device.
The span arithmetic that traces a composition along a ray: each operand's spans (where the ray is ins...
Declaration of 2D and 3D point/vector classes with templated precision, and free functions on them.
Three-dimensional vector class with arithmetic operators.
Definition EBGeometry_Vec.hpp:258
static constexpr Vec3T< T > zeros() noexcept
Return a vector with x = y = z = 0.
Namespace containing all of EBGeometry's functionality.
Definition EBGeometry_Affine.hpp:26
@ Exact
The value's magnitude is the Euclidean distance to the surface.
HitStatus
The outcome of a ray query.
Definition EBGeometry_Ray.hpp:84
@ Unresolved
The query ran out of steps or passes before it could decide (a ray grazing the surface,...
@ Miss
The ray does not cross the surface in the interval.
@ Hit
The ray crosses the surface; HitT says where.
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
bool m_entering
Whether the ray enters the object there (it was outside just before), rather than leaving it.
Definition EBGeometry_Ray.hpp:129
bool m_exact
Whether the crossing is exact (found by a ray form), rather than found to within RayOptions::m_tolera...
Definition EBGeometry_Ray.hpp:135
bool hit() const noexcept
Whether the ray crosses the surface.
T m_t
Distance along the ray: of the crossing for a hit, of the last point reached for an unresolved query,...
Definition EBGeometry_Ray.hpp:106
Vec3T< T > m_normal
The outward unit normal at the crossing: from the shape's ray form, or the normalized gradient of its...
Definition EBGeometry_Ray.hpp:124
uint32_t m_primitive
The finest element the shape can name at the crossing: the face of a mesh SDF, the deciding leaf of a...
Definition EBGeometry_Ray.hpp:118
HitStatus m_status
Whether the ray crosses the surface.
Definition EBGeometry_Ray.hpp:100
Vec3T< T > m_point
The point at m_t (for a hit or an unresolved query).
Definition EBGeometry_Ray.hpp:111
Numeric limits, with the meanings of the std::numeric_limits members of the same names.
Definition EBGeometry_Math.hpp:91
How a query marches, where a shape has no ray form.
Definition EBGeometry_Ray.hpp:155
A span: where the ray enters, and where it leaves.
Definition EBGeometry_Ray.hpp:258
SpanEndT< T > m_out
Where it leaves.
Definition EBGeometry_Ray.hpp:267
SpanEndT< T > m_in
Where the ray enters.
Definition EBGeometry_Ray.hpp:262
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
void addClipped(T a_in, T a_out, T a_t0, T a_t1) noexcept
Append the span [a_in, a_out] cut to [a_t0, a_t1]: an end outside it (or infinite) becomes an Open en...
void add(const SpanEndT< T > &a_in, const SpanEndT< T > &a_out) noexcept
Append a span after the last one, or, if the list is full, drop it and lower the horizon to where it ...
void reset(T a_horizon) noexcept
Empty the list, complete up to a horizon.
A ray: the points origin + t * direction.
Definition EBGeometry_Ray.hpp:54
Vec3T< T > m_direction
Unit direction.
Definition EBGeometry_Ray.hpp:68
T Scalar
Floating-point precision.
Definition EBGeometry_Ray.hpp:58
Vec3T< T > at(T a_t) const noexcept
The point at a distance along the ray.
Vec3T< T > m_origin
Where the ray starts.
Definition EBGeometry_Ray.hpp:63
One end of a span: where a ray enters or leaves an object.
Definition EBGeometry_Ray.hpp:200
Kind m_kind
What the end is.
Definition EBGeometry_Ray.hpp:225
T m_t
Distance along the ray.
Definition EBGeometry_Ray.hpp:214
Kind
What an end is.
Definition EBGeometry_Ray.hpp:205
uint32_t m_leaf
Which of a composition's leaves the crossing lies on, numbered by the composition; a shape that is no...
Definition EBGeometry_Ray.hpp:220
bool crossing() const noexcept
Whether the end is a crossing of the surface.