14#include <lagrange/raycasting/api.h>
15#include <lagrange/scene/SimpleScene.h>
16#include <lagrange/utils/ProgressCallback.h>
17#include <lagrange/utils/function_ref.h>
18#include <lagrange/utils/span.h>
19#include <lagrange/utils/value_ptr.h>
61template <
typename Scalar,
typename Index>
90 function_ref<bool(Index mesh_index, Index instance_index)> is_occluder = [](Index, Index) {
94 ~OccludedFacetSampler();
95 OccludedFacetSampler(OccludedFacetSampler&&) noexcept;
96 OccludedFacetSampler& operator=(OccludedFacetSampler&&) noexcept;
100 void run_normal_batch(uint64_t num_rays);
104 void run_adaptive_batch(uint64_t num_rays);
108 void run_brute_force_batch(uint64_t num_rays);
111 bool is_visible(uint64_t global_facet_index) const;
114 uint64_t num_rays_cast(uint64_t global_facet_index) const;
118 uint64_t num_facets() const;
121 span<const InstanceInfo> instances() const;
169template <
typename Scalar,
typename Index>
174 const std::atomic_bool* cancel =
nullptr);
205template <
typename Scalar,
typename Index>
210 function_ref<
bool(Index mesh_index, Index instance_index)> is_occluder =
211 [](Index, Index) {
return true; },
212 const std::atomic_bool* cancel =
nullptr);
A simple thread-safe progress callback.
Definition ProgressCallback.h:27
A lightweight non-owning reference to a callable.
Definition function_ref.h:47
Stateful algorithm for finding occluded facets across every instance of a scene.
Definition remove_occluded_facets.h:63
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.
Simple scene container for instanced meshes.
Definition SimpleScene.h:62
Smart pointer with value semantics.
Definition value_ptr.h:134
LA_RAYCASTING_API scene::SimpleScene< Scalar, Index, 3 > remove_occluded_facets(const scene::SimpleScene< Scalar, Index, 3 > &scene, const RemoveOccludedFacetsOptions &options, ProgressCallback &progress, function_ref< bool(Index mesh_index, Index instance_index)> is_occluder=[](Index, Index) { return true;}, const std::atomic_bool *cancel=nullptr)
Build a new scene with facets not visible from the outside removed.
LA_RAYCASTING_API void estimate_occluded_facets(OccludedFacetSampler< Scalar, Index > &sampler, const OccludedFacetEstimateOptions &options, ProgressCallback &progress, const std::atomic_bool *cancel=nullptr)
Drive an OccludedFacetSampler progressively until the budget is exhausted, the search converges,...
Definition remove_occluded_facets.cpp:399
::nonstd::span< T, Extent > span
A bounds-safe view for sequences of objects.
Definition span.h:27
Raycasting operations.
Definition compute_local_feature_size.h:20
Loop options for estimate_occluded_facets() and remove_occluded_facets().
Definition remove_occluded_facets.h:132
uint64_t num_adaptive_per_normal
Adaptive batches per normal batch.
Definition remove_occluded_facets.h:144
uint64_t num_rays
Total ray budget.
Definition remove_occluded_facets.h:135
bool until_converged
Stop early when a cycle finds no new visible facets.
Definition remove_occluded_facets.h:150
uint64_t batch_size
Rays per batch.
Definition remove_occluded_facets.h:140
bool brute_force
Run brute-force batches only — baseline for benchmarking against the adaptive mode.
Definition remove_occluded_facets.h:147
Maps a global facet index back to (mesh, instance, local facet).
Definition remove_occluded_facets.h:69
uint64_t facet_offset
Global index of this instance's first facet in the flat arrays (is_visible, etc.).
Definition remove_occluded_facets.h:73
Index num_facets
Number of facets in this instance's mesh.
Definition remove_occluded_facets.h:75
Options for OccludedFacetSampler.
Definition remove_occluded_facets.h:34
uint8_t visibility_threshold
Number of independent escapes a facet must accumulate before being marked visible.
Definition remove_occluded_facets.h:42
double jitter_sigma
Standard deviation of the Gaussian jitter applied to seed directions in adaptive batches.
Definition remove_occluded_facets.h:36
Options for remove_occluded_facets().
Definition remove_occluded_facets.h:180
OccludedFacetEstimateOptions estimate_options
Estimate-loop options forwarded to estimate_occluded_facets().
Definition remove_occluded_facets.h:182
OccludedFacetSamplerOptions sampler_options
Options forwarded to the underlying OccludedFacetSampler.
Definition remove_occluded_facets.h:185