30#ifndef EBGEOMETRY_RAY_HPP
31#define EBGEOMETRY_RAY_HPP
79 at(T a_t)
const noexcept;
211 T m_tolerance = T(1e-4);
221 uint32_t m_maxSteps = 512;
233 bool m_march =
false;
300 static constexpr uint32_t Capacity = 8;
326 uint32_t m_count = 0;
399template <
class S,
class =
void>
419template <
class T,
class S>
442template <class T, class S>
445firstHit(const S& a_shape,
446 const
Vec3T<T>& a_from,
447 const
Vec3T<T>& a_to,
464template <class T, class S>
467intersects(const S& a_shape,
468 const
RayT<T>& a_ray,
469 typename
RayT<T>::Scalar a_tMin,
470 typename
RayT<T>::Scalar a_tMax,
487template <class T, class S>
490intersects(const S& a_shape,
491 const
Vec3T<T>& a_from,
492 const
Vec3T<T>& a_to,
512template <class T, class S>
515firstCrossing(const S& a_shape,
516 const
RayT<T>& a_ray,
517 typename
RayT<T>::Scalar a_tMin,
518 typename
RayT<T>::Scalar a_tMax,
535template <class T, class S>
538firstCrossing(const S& a_shape,
539 const
Vec3T<T>& a_from,
540 const
Vec3T<T>& a_to,
578template <
class T,
class S>
599template <class T, class S>
602firstSurface(const S& a_shape,
603 const
Vec3T<T>& a_from,
604 const
Vec3T<T>& a_to,
610#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...
SurfaceRef: which surface of a shape decides its value at a point, and the container protocol that na...
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:86
@ 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.
SurfaceHitT< T > firstSurface(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
A ray's first crossing of a shape's surface, and the surface it crossed: the ray counterpart of close...
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, without the normal or the primitive there: what firstCrossing() ...
Definition EBGeometry_Ray.hpp:157
bool hit() const noexcept
Whether the ray crosses the surface.
Where a ray first crosses a surface.
Definition EBGeometry_Ray.hpp:98
bool m_entering
Whether the ray enters the object there (it was outside just before), rather than leaving it.
Definition EBGeometry_Ray.hpp:131
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:137
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:108
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:126
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:120
HitStatus m_status
Whether the ray crosses the surface.
Definition EBGeometry_Ray.hpp:102
Vec3T< T > m_point
The point at m_t (for a hit or an unresolved query).
Definition EBGeometry_Ray.hpp:113
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:203
A span: where the ray enters, and where it leaves.
Definition EBGeometry_Ray.hpp:306
SpanEndT< T > m_out
Where it leaves.
Definition EBGeometry_Ray.hpp:315
SpanEndT< T > m_in
Where the ray enters.
Definition EBGeometry_Ray.hpp:310
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:296
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:56
Vec3T< T > m_direction
Unit direction.
Definition EBGeometry_Ray.hpp:70
T Scalar
Floating-point precision.
Definition EBGeometry_Ray.hpp:60
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:65
One end of a span: where a ray enters or leaves an object.
Definition EBGeometry_Ray.hpp:248
Kind m_kind
What the end is.
Definition EBGeometry_Ray.hpp:273
T m_t
Distance along the ray.
Definition EBGeometry_Ray.hpp:262
Kind
What an end is.
Definition EBGeometry_Ray.hpp:253
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:268
bool crossing() const noexcept
Whether the end is a crossing of the surface.
A ray's first crossing of a shape's surface, with the surface it crossed, as firstSurface() reports i...
Definition EBGeometry_Ray.hpp:550
SurfaceRef< T > m_surface
The surface crossed, drilled down as closestSurface() does (its surface, leaf, label,...
Definition EBGeometry_Ray.hpp:560
HitT< T > m_hit
The crossing, as firstHit() reports it.
Definition EBGeometry_Ray.hpp:554
The surface that decides a shape's value at a point, as closestSurface() reports it.
Definition EBGeometry_SurfaceRef.hpp:39