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
 
OccludedFacetSampler & operator= (OccludedFacetSampler &&) noexcept
 
void run_batch (uint64_t num_rays)
 Trace one batch of num_rays rays, distributed across facets not yet decided.
 
bool is_visible (uint64_t global_facet_index) const
 Whether the facet is currently kept, i.e. visibility_measure >= threshold.
 
double visibility_measure (uint64_t global_facet_index) const
 The facet's visibility measure mean_visibility * (area_f / mean_face_area)^size_influence, where mean_visibility is the plain or MIS estimate of the cosine-weighted escaped fraction.
 
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.
 
uint64_t num_retired () const
 Number of facets confidently above the keep threshold and retired from sampling.
 
span< const InstanceInfo > instances () const
 Per-instance metadata for mapping global facet indices to (mesh, instance, local facet).
 

Detailed Description

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

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

Each call to run_batch distributes rays over facets not yet decided, progressively improving the result. Per-facet results are addressed by a global facet index (mapped back via instances).

The sampling strategy is fixed at construction by OccludedFacetSamplerOptions::adaptive: plain cosine-weighted hemisphere sampling, or adaptive sampling that reuses escape directions to find small holes faster.

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

◆ num_facets()

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

Total number of facets across all instances.

Multi-instance meshes are counted once per instance.

◆ num_retired()

template<typename Scalar, typename Index>
uint64_t num_retired ( ) const
nodiscard

Number of facets confidently above the keep threshold and retired from sampling.

This is useful to progressive callers for reporting and detecting that all facets have retired.


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