EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Classes | Namespaces | Functions
EBGeometry_MeshRayForms.hpp File Reference

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"
Include dependency graph for EBGeometry_MeshRayForms.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

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::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...
 

Namespaces

namespace  EBGeometry
 Namespace containing all of EBGeometry's functionality.
 

Functions

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.
 

Detailed Description

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

Function Documentation

◆ 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
TFloating-point precision.
Parameters
[in]a_rayRay.
[in]a_tDistance along the ray, or +infinity for none.
[in]a_faceThe face's id.
[in]a_normalThe face's outward unit normal.
Returns
The hit, or a miss.