|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
Ray queries on any shape: where a ray, or the segment between two points, first crosses its surface (firstHit()), and whether it crosses it at all (intersects()). More...
#include <cstdint>#include <type_traits>#include "EBGeometry_BoundingVolumes.hpp"#include "EBGeometry_DistanceQuality.hpp"#include "EBGeometry_GPU.hpp"#include "EBGeometry_Math.hpp"#include "EBGeometry_Vec.hpp"#include "EBGeometry_RayImplem.hpp"#include "EBGeometry_RaySpans.hpp"

Go to the source code of this file.
Classes | |
| struct | EBGeometry::RayT< T > |
| A ray: the points origin + t * direction. More... | |
| struct | EBGeometry::HitT< T > |
| Where a ray first crosses a surface. More... | |
| struct | EBGeometry::RayOptions< T > |
| How a query marches, where a shape has no ray form. More... | |
| struct | EBGeometry::SpanEndT< T > |
| One end of a span: where a ray enters or leaves an object. More... | |
| struct | EBGeometry::RaySpansT< T > |
| Where a ray is inside an object over an interval [t0, t1]: its spans, in order, each from where it enters to where it leaves, complete up to a horizon. More... | |
| struct | EBGeometry::RaySpansT< T >::Span |
| A span: where the ray enters, and where it leaves. More... | |
| struct | EBGeometry::RayForm< S, class > |
| How to ray trace a shape directly, instead of marching its signed distance. More... | |
Namespaces | |
| namespace | EBGeometry |
| Namespace containing all of EBGeometry's functionality. | |
Enumerations | |
| enum class | EBGeometry::HitStatus : uint8_t { EBGeometry::Miss , EBGeometry::Hit , EBGeometry::Unresolved } |
| The outcome of a ray query. More... | |
Functions | |
| template<class T , class S > | |
| HitT< T > | EBGeometry::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. | |
| template<class T , class S > | |
| HitT< T > | EBGeometry::firstHit (const S &a_shape, const Vec3T< T > &a_from, const Vec3T< T > &a_to, T a_tMin=T(0), const RayOptions< T > &a_options=RayOptions< T >()) noexcept |
| The first crossing of a shape's surface on the segment from a_from to a_to. | |
| template<class T , class S > | |
| HitStatus | EBGeometry::intersects (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 |
| Whether a ray crosses a shape's surface in [a_tMin, a_tMax]. | |
| template<class T , class S > | |
| HitStatus | EBGeometry::intersects (const S &a_shape, const Vec3T< T > &a_from, const Vec3T< T > &a_to, T a_tMin=T(0), const RayOptions< T > &a_options=RayOptions< T >()) noexcept |
| Whether the segment from a_from to a_to crosses a shape's surface. | |
Ray queries on any shape: where a ray, or the segment between two points, first crosses its surface (firstHit()), and whether it crosses it at all (intersects()).
The queries need only a shape's signed distance and bounding box, so they work for every shape (see isShape): analytic shapes, mesh SDFs, BVH unions, fused compositions, tapes and user types. Along the part of the ray inside the shape's box they march: they sphere trace (step by the value, which never steps over the surface) where the value is a distance or a bound on one, and step at a fixed length and bisect on a sign change where it is not (DistanceQuality::NotADistance). A query that cannot decide within its step budget says so (HitStatus::Unresolved) instead of reporting a miss.
A shape with a ray form (see RayForm) is ray traced instead, which is exact and much faster: the plane, sphere, box, cylinders and capsule in closed form (EBGeometry_AnalyticRayForms.hpp), the mesh SDFs through their BVHs and faces (EBGeometry_MeshRayForms.hpp), and the compositions built from them, a union, intersection, difference, complement or affine map of shapes with ray forms (the fused operations and BVHUnion in EBGeometry_CSGRayForms.hpp, and Tape): those combine where the ray is inside each operand (its spans, see RaySpansT), and march only the parts that have no ray form. An offset or annulus of a shape whose level sets have a closed form (a plane, sphere, box, infinite cylinder, capsule or mesh SDF, or an affine map of one) is traced exactly too (EBGeometry_OffsetRayForms.hpp): always as a fused operation, and in a tape that lists TapeFeature::ExactOffsets. RayOptions::m_march marches any shape instead.