The ray forms (see RayForm) of the mesh SDFs. TriMeshSDF: its BVH walked along the ray (PackedBVH::traverse() with BVH::RayQuery), and its triangles crossed exactly (TriangleRay::crossing()). MeshSDF: the same walk, its polygon faces crossed exactly (DCEL::FaceT::rayCrossing()). FlatMeshSDF: every face, without a BVH. With this header included, firstHit() and intersects() on a mesh SDF are exact instead of marched, and so are compositions of mesh SDFs (see EBGeometry_CSGRayForms.hpp), through spans(): the crossings along the ray, nearest first, paired into spans by the side of the face the ray crosses from. A closed mesh is needed for the spans to mean inside and outside.
More...
#include <cstddef>
#include <cstdint>
#include "EBGeometry_MeshDistanceFunctions.hpp"
#include "EBGeometry_Ray.hpp"
Go to the source code of this file.
|
| struct | EBGeometry::RayForm< TriMeshSDF< T, K, W > > |
| | TriMeshSDF's ray form: the nearest triangle the ray crosses, found by walking the BVH nearest box first and stopping at boxes farther than the nearest crossing so far. Exact, and callable on a device. More...
|
| |
| struct | EBGeometry::RayForm< MeshSDF< T, K > > |
| | MeshSDF's ray form: the nearest polygon face the ray crosses, found by walking the BVH nearest box first and stopping at boxes farther than the nearest crossing so far. Exact, and callable on a device. More...
|
| |
| struct | EBGeometry::RayForm< FlatMeshSDF< T > > |
| | FlatMeshSDF's ray form: every face tested, as FlatMeshSDF's signed distance tests every face (no BVH). Exact, and callable on a device; as for MeshSDF otherwise. More...
|
| |
| struct | EBGeometry::RayDetail::TracedOnCheaply< TriMeshSDF< T, K, W > > |
| | A TriMeshSDF is traced on past an interval (see TracedOnCheaply). More...
|
| |
| struct | EBGeometry::RayDetail::HitNamesPart< TriMeshSDF< T, K, W > > |
| | A TriMeshSDF's crossing names its face, its part (see HitNamesPart). More...
|
| |
| struct | EBGeometry::RayDetail::TracedOnCheaply< MeshSDF< T, K > > |
| | A MeshSDF is traced on past an interval (see TracedOnCheaply). More...
|
| |
| struct | EBGeometry::RayDetail::HitNamesPart< MeshSDF< T, K > > |
| | A MeshSDF's crossing names its face, its part (see HitNamesPart). More...
|
| |
| struct | EBGeometry::RayDetail::TracedOnCheaply< FlatMeshSDF< T > > |
| | A FlatMeshSDF is traced on past an interval (see TracedOnCheaply): its trace visits every face, and so does the distance query it saves. More...
|
| |
| struct | EBGeometry::RayDetail::HitNamesPart< FlatMeshSDF< T > > |
| | A FlatMeshSDF's crossing names its face, its part (see HitNamesPart). More...
|
| |
| struct | EBGeometry::RayDetail::NearestCrossings< T > |
| | The nearest crossings of a mesh along a ray, in order, as a BVH walk finds them: at most Capacity, enough for the spans a list holds and one more. More...
|
| |
| struct | EBGeometry::RayDetail::NearestCrossings< T >::Crossing |
| | A crossing. More...
|
| |
|
| template<class T > |
| HitT< T > | EBGeometry::RayDetail::faceHit (const RayT< T > &a_ray, const T a_t, const uint32_t a_face, const Vec3T< T > &a_normal) noexcept |
| | A crossing of a mesh face as a HitT.
|
| |
| template<class T > |
| T | EBGeometry::RayDetail::tieReach (const RayT< T > &a_ray, const T a_nearestT, const bool a_found, const T a_tMax) noexcept |
| | How far past a mesh's nearest crossing so far its first hit still looks: crossings within a few ulps of the nearest are one tie, which the face with the lowest id wins (see replacesNearest()).
|
| |
| template<class T > |
| bool | EBGeometry::RayDetail::replacesNearest (const RayT< T > &a_ray, const T a_t, const uint32_t a_face, const T a_nearestT, const uint32_t a_nearestFace) noexcept |
| | Whether a face's crossing replaces a mesh's nearest crossing so far in its first hit: there is none so far, or it is nearer by more than the tie window, or within the window with a lower face id (see tieReach()).
|
| |
The ray forms (see RayForm) of the mesh SDFs. TriMeshSDF: its BVH walked along the ray (PackedBVH::traverse() with BVH::RayQuery), and its triangles crossed exactly (TriangleRay::crossing()). MeshSDF: the same walk, its polygon faces crossed exactly (DCEL::FaceT::rayCrossing()). FlatMeshSDF: every face, without a BVH. With this header included, firstHit() and intersects() on a mesh SDF are exact instead of marched, and so are compositions of mesh SDFs (see EBGeometry_CSGRayForms.hpp), through spans(): the crossings along the ray, nearest first, paired into spans by the side of the face the ray crosses from. A closed mesh is needed for the spans to mean inside and outside.
- Author
- Robert Marskar
◆ faceHit()
template<class T >
| HitT< T > EBGeometry::RayDetail::faceHit |
( |
const RayT< T > & |
a_ray, |
|
|
const T |
a_t, |
|
|
const uint32_t |
a_face, |
|
|
const Vec3T< T > & |
a_normal |
|
) |
| |
|
inlinenoexcept |
A crossing of a mesh face as a HitT.
Internal helper; not part of the public API.
- Template Parameters
-
| T | Floating-point precision. |
- Parameters
-
| [in] | a_ray | Ray. |
| [in] | a_t | Distance along the ray, or +infinity for none. |
| [in] | a_face | The face's id. |
| [in] | a_normal | The face's outward unit normal. |
- Returns
- The hit, or a miss.
◆ replacesNearest()
template<class T >
| bool EBGeometry::RayDetail::replacesNearest |
( |
const RayT< T > & |
a_ray, |
|
|
const T |
a_t, |
|
|
const uint32_t |
a_face, |
|
|
const T |
a_nearestT, |
|
|
const uint32_t |
a_nearestFace |
|
) |
| |
|
inlinenoexcept |
Whether a face's crossing replaces a mesh's nearest crossing so far in its first hit: there is none so far, or it is nearer by more than the tie window, or within the window with a lower face id (see tieReach()).
Internal helper; not part of the public API. Every mesh SDF's firstHit() keeps its nearest crossing with this rule. Where every crossing of the tie lies within one window of the strictly nearest, which is the case at a shared edge or vertex (a few ulps apart against a window of 16), the face it names depends neither on the order the walk visits the faces nor on the rounding of their distances. A chain of crossings spread over more than one window can still go either way: a replacing face moves the window with it, and a rule that does not would have to remember the crossings it passed over.
- Template Parameters
-
| T | Floating-point precision. |
- Parameters
-
| [in] | a_ray | Ray. |
| [in] | a_t | The face's crossing (finite). |
| [in] | a_face | The face's id. |
| [in] | a_nearestT | The nearest crossing so far. |
| [in] | a_nearestFace | Its face's id, UINT32_MAX for none so far. |
- Returns
- Whether the face's crossing is the nearest now.
◆ tieReach()
template<class T >
| T EBGeometry::RayDetail::tieReach |
( |
const RayT< T > & |
a_ray, |
|
|
const T |
a_nearestT, |
|
|
const bool |
a_found, |
|
|
const T |
a_tMax |
|
) |
| |
|
inlinenoexcept |
How far past a mesh's nearest crossing so far its first hit still looks: crossings within a few ulps of the nearest are one tie, which the face with the lowest id wins (see replacesNearest()).
Internal helper; not part of the public API. A ray through an edge or a vertex shared by several faces crosses each of them at the same point, at distances that differ by each face's rounding: a few ulps of the distance and of the ray origin's coordinates, as the crossing test's own widening measures them (TriangleRay::crossing()). A host and a device round them differently (a device fuses multiplies and adds), so the strictly nearest crossing picks one face on one side and another on the other, with another normal. The window is 16 ulps of the distance plus the origin's coordinates: on a float armadillo (99,976 triangles) seen from about 300 away, the faces at a vertex crossed 0 to 9 ulps apart, and a host's and a device's crossing of one face 1 to 4. Ties broken by the lowest face id in that window left one pixel of 262,144 with another face on the device (a ray grazing an edge, which one side's widened inside test counts as crossing a face and the other does not), against 35 broken by distance alone.
- Template Parameters
-
| T | Floating-point precision. |
- Parameters
-
| [in] | a_ray | Ray. |
| [in] | a_nearestT | The nearest crossing so far. |
| [in] | a_found | Whether there is one. |
| [in] | a_tMax | End of the query's interval, which the reach never passes. |
- Returns
- How far along the ray a face may still be crossed and win: a_tMax until a crossing is found.