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

Stateful algorithm for finding occluded instances in a scene. More...

#include <lagrange/raycasting/remove_occluded_instances.h>

Classes

struct  Impl
 

Public Member Functions

 OccludedInstanceSampler (const scene::SimpleScene< Scalar, Index, 3 > &scene, const OccludedInstanceSamplerOptions &options={}, function_ref< bool(Index mesh_index, Index instance_index)> is_occluder=[](Index, Index) { return true;})
 Build the ray caster and per-instance precomputation.
 
 OccludedInstanceSampler (OccludedInstanceSampler &&) noexcept
 
OccludedInstanceSampler & operator= (OccludedInstanceSampler &&) noexcept
 
void run_batch (uint64_t num_rays)
 Run a batch distributing num_rays across instances not yet decided.
 
bool is_visible (Index mesh_index, Index instance_index) const
 Whether the instance is currently kept: visibility_measure(mesh, instance) >= threshold.
 
double visibility_measure (Index mesh_index, Index instance_index) const
 The instance's visibility measure mean_visibility * (area / R)^size_influence, where mean_visibility is the estimated cosine-weighted escaped fraction in [0, 1].
 
uint64_t num_rays_cast (Index mesh_index, Index instance_index) const
 Rays cast so far for the instance.
 
Index num_instances () const
 Total number of instances across all meshes.
 
Index num_retired () const
 Number of instances confidently above the keep threshold and retired from sampling.
 
std::pair< Index, uint64_t > progress () const
 Aggregate (number of currently-visible instances, total rays cast) for progress reporting without rescanning the scene's (mesh_index, instance_index) address space.
 

Detailed Description

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

Stateful algorithm for finding occluded instances in a scene.

Each call to run_batch distributes rays over instances not yet decided, progressively improving the result. Per-instance results are addressed by (mesh_index, instance_index).

Note
Only 3D scenes are supported.
Template Parameters
ScalarMesh scalar type.
IndexMesh index type.

Constructor & Destructor Documentation

◆ OccludedInstanceSampler()

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

Build the ray caster and per-instance precomputation.

Parameters
[in]sceneScene to process.
[in]optionsSampler options (keep-threshold, size influence, confidence).
[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_retired()

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

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

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


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