EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
EBGeometry_AnalyticRayForms.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Robert Marskar <robert.marskar@sintef.no>
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
14#ifndef EBGEOMETRY_ANALYTICRAYFORMS_HPP
15#define EBGEOMETRY_ANALYTICRAYFORMS_HPP
16
17// Our includes
19#include "EBGeometry_Ray.hpp"
20
21namespace EBGeometry {
22
27template <class T>
28struct RayForm<PlaneSDF<T>>
29{
39 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
40 static inline HitT<T>
42 const PlaneSDF<T>& a_shape, const RayT<T>& a_ray, T a_tMin, T a_tMax, const RayOptions<T>& a_options) noexcept;
43
55 static inline void
56 spans(const PlaneSDF<T>& a_shape,
57 const RayT<T>& a_ray,
58 T a_tMin,
59 T a_tMax,
60 const RayOptions<T>& a_options,
61 bool a_firstOnly,
62 RaySpansT<T>& a_spans) noexcept;
63};
64
69template <class T>
71{
81 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
82 static inline HitT<T>
84 const SphereSDF<T>& a_shape, const RayT<T>& a_ray, T a_tMin, T a_tMax, const RayOptions<T>& a_options) noexcept;
85
97 static inline void
98 spans(const SphereSDF<T>& a_shape,
99 const RayT<T>& a_ray,
100 T a_tMin,
101 T a_tMax,
102 const RayOptions<T>& a_options,
103 bool a_firstOnly,
104 RaySpansT<T>& a_spans) noexcept;
105};
106
111template <class T>
112struct RayForm<BoxSDF<T>>
113{
123 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
124 static inline HitT<T>
125 firstHit(const BoxSDF<T>& a_shape, const RayT<T>& a_ray, T a_tMin, T a_tMax, const RayOptions<T>& a_options) noexcept;
126
138 static inline void
139 spans(const BoxSDF<T>& a_shape,
140 const RayT<T>& a_ray,
141 T a_tMin,
142 T a_tMax,
143 const RayOptions<T>& a_options,
144 bool a_firstOnly,
145 RaySpansT<T>& a_spans) noexcept;
146};
147
152template <class T>
154{
164 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
165 static inline HitT<T>
167 const CylinderSDF<T>& a_shape, const RayT<T>& a_ray, T a_tMin, T a_tMax, const RayOptions<T>& a_options) noexcept;
168
180 static inline void
181 spans(const CylinderSDF<T>& a_shape,
182 const RayT<T>& a_ray,
183 T a_tMin,
184 T a_tMax,
185 const RayOptions<T>& a_options,
186 bool a_firstOnly,
187 RaySpansT<T>& a_spans) noexcept;
188};
189
194template <class T>
196{
206 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
207 static inline HitT<T>
209 const RayT<T>& a_ray,
210 T a_tMin,
211 T a_tMax,
212 const RayOptions<T>& a_options) noexcept;
213
225 static inline void
227 const RayT<T>& a_ray,
228 T a_tMin,
229 T a_tMax,
230 const RayOptions<T>& a_options,
231 bool a_firstOnly,
232 RaySpansT<T>& a_spans) noexcept;
233};
234
239template <class T>
241{
251 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
252 static inline HitT<T>
254 const CapsuleSDF<T>& a_shape, const RayT<T>& a_ray, T a_tMin, T a_tMax, const RayOptions<T>& a_options) noexcept;
255
267 static inline void
268 spans(const CapsuleSDF<T>& a_shape,
269 const RayT<T>& a_ray,
270 T a_tMin,
271 T a_tMax,
272 const RayOptions<T>& a_options,
273 bool a_firstOnly,
274 RaySpansT<T>& a_spans) noexcept;
275};
276
277} // namespace EBGeometry
278
279#include "EBGeometry_AnalyticRayFormsImplem.hpp"
280
281#endif
File containing various analytic signed distance fields.
#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
Ray queries on any shape: where a ray, or the segment between two points, first crosses its surface (...
Signed distance field for an axis-aligned box (AABB).
Definition EBGeometry_AnalyticDistanceFunctions.hpp:351
Signed distance field for a capsule (pill shape): a cylinder capped with hemispheres.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:1117
Signed distance field for a finite, flat-capped cylinder.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:728
Signed distance field for an infinitely long cylinder.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:947
Signed distance function for a plane.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:60
Signed distance field for a sphere.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:199
Namespace containing all of EBGeometry's functionality.
Definition EBGeometry_Affine.hpp:26
Where a ray first crosses a surface.
Definition EBGeometry_Ray.hpp:96
static HitT< T > firstHit(const BoxSDF< T > &a_shape, const RayT< T > &a_ray, T a_tMin, T a_tMax, const RayOptions< T > &a_options) noexcept
The first crossing of the box along a ray.
static void spans(const BoxSDF< 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
Where a ray is inside the box over an interval: one span, the box being convex.
static void spans(const CapsuleSDF< 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
Where a ray is inside the capsule over an interval: one span, the capsule being convex.
static HitT< T > firstHit(const CapsuleSDF< T > &a_shape, const RayT< T > &a_ray, T a_tMin, T a_tMax, const RayOptions< T > &a_options) noexcept
The first crossing of the capsule along a ray.
static HitT< T > firstHit(const CylinderSDF< T > &a_shape, const RayT< T > &a_ray, T a_tMin, T a_tMax, const RayOptions< T > &a_options) noexcept
The first crossing of the cylinder along a ray.
static void spans(const CylinderSDF< 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
Where a ray is inside the cylinder over an interval: one span, the cylinder being convex.
static void spans(const InfiniteCylinderSDF< 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
Where a ray is inside the cylinder over an interval: one span, the cylinder being convex.
static HitT< T > firstHit(const InfiniteCylinderSDF< T > &a_shape, const RayT< T > &a_ray, T a_tMin, T a_tMax, const RayOptions< T > &a_options) noexcept
The first crossing of the cylinder along a ray.
static void spans(const PlaneSDF< 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
Where a ray is inside the plane over an interval: the half-space behind it.
static HitT< T > firstHit(const PlaneSDF< T > &a_shape, const RayT< T > &a_ray, T a_tMin, T a_tMax, const RayOptions< T > &a_options) noexcept
The first crossing of the plane along a ray.
static HitT< T > firstHit(const SphereSDF< T > &a_shape, const RayT< T > &a_ray, T a_tMin, T a_tMax, const RayOptions< T > &a_options) noexcept
The first crossing of the sphere along a ray.
static void spans(const SphereSDF< 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
Where a ray is inside the sphere over an interval: one span, the sphere being convex.
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