Lagrange
Loading...
Searching...
No Matches
OccludedFacetSampler< Scalar, Index > Class Template Reference

Stateful algorithm for finding occluded facets across every instance of a scene. More...

#include <lagrange/raycasting/remove_occluded_facets.h>

Classes

struct  Impl
 
struct  InstanceInfo
 Maps a global facet index back to (mesh, instance, local facet). More...
 

Public Member Functions

 OccludedFacetSampler (const scene::SimpleScene< Scalar, Index, 3 > &scene, const OccludedFacetSamplerOptions &options={}, function_ref< bool(Index mesh_index, Index instance_index)> is_occluder=[](Index, Index) { return true;})
 Build the ray caster and per-instance world-space facet data.
 
 OccludedFacetSampler (OccludedFacetSampler &&) noexcept
 
OccludedFacetSampleroperator= (OccludedFacetSampler &&) noexcept
 
void run_normal_batch (uint64_t num_rays)
 Cosine-weighted hemisphere batch.
 
void run_adaptive_batch (uint64_t num_rays)
 Adaptive batch using cached escape directions of 1-ring visible neighbors.
 
void run_brute_force_batch (uint64_t num_rays)
 Cosine-weighted hemisphere batch with no escape caching — baseline for benchmarking the adaptive mode against pure sampling.
 
bool is_visible (uint64_t global_facet_index) const
 Whether the facet has been marked visible so far.
 
uint64_t num_rays_cast (uint64_t global_facet_index) const
 Rays cast so far for the facet.
 
uint64_t num_facets () const
 Total number of facets across all instances.
 
span< const InstanceInfoinstances () const
 Per-instance metadata for mapping global facet indices to (mesh, instance, local facet).
 

Detailed Description

template<typename Scalar, typename Index>
class lagrange::raycasting::OccludedFacetSampler< Scalar, Index >

Stateful algorithm for finding occluded facets across every instance of a scene.

Each instance is gated independently with its own world-space facets.

Combines two sampling strategies that can be alternated progressively:

  • run_normal_batch : cosine-weighted hemisphere sampling. The first escape direction is cached against the facet that escaped.
  • run_adaptive_batch : for each still-occluded facet, casts jittered rays along cached escape directions of its edge-adjacent visible neighbors. Exploits topological coherence — an escape from a neighbor often also escapes from here.
Note
Only 3D scenes are supported. Meshes must be triangle meshes.
Template Parameters
ScalarMesh scalar type.
IndexMesh index type.

Constructor & Destructor Documentation

◆ OccludedFacetSampler()

template<typename Scalar, typename Index>
OccludedFacetSampler ( const scene::SimpleScene< Scalar, Index, 3 > & scene,
const OccludedFacetSamplerOptions & options = {},
function_ref< bool(Index mesh_index, Index instance_index)> is_occluder = [](Index, Index) { return true;} )
explicit

Build the ray caster and per-instance world-space facet data.

Parameters
[in]sceneScene to process. Every referenced mesh must be a triangle mesh.
[in]optionsSampler options.
[in]is_occluderReturns whether (mesh_index, instance_index) should block rays. Non-occluder instances are still tested for visibility but do not contribute to the ray-caster scene.

Member Function Documentation

◆ run_normal_batch()

template<typename Scalar, typename Index>
void run_normal_batch ( uint64_t num_rays)

Cosine-weighted hemisphere batch.

Caches each facet's first-discovered escape direction for later adaptive batches.

◆ run_adaptive_batch()

template<typename Scalar, typename Index>
void run_adaptive_batch ( uint64_t num_rays)

Adaptive batch using cached escape directions of 1-ring visible neighbors.

Skips facets with no visible neighbor.

◆ num_facets()

template<typename Scalar, typename Index>
uint64_t num_facets ( ) const

Total number of facets across all instances.

Multi-instance meshes are counted once per instance.


The documentation for this class was generated from the following files: