pub fn importance_sample(
coarse_t: &[f32],
weights: &[f32],
n_fine: usize,
rng: &mut LcgRng,
) -> NerfResult<Vec<f32>>Expand description
Draw n_fine sample positions using inverse-CDF sampling from coarse weights.
Implements hierarchical NeRF sampling:
- Build CDF from weights (with small ε for numerical stability, renormalize).
- Draw n_fine uniform samples u_j in [0, 1].
- Binary search for u_j in CDF to get t_low, t_high.
- Linearly interpolate for exact t position.
§Errors
Returns DimensionMismatch if coarse_t.len() != weights.len(),
InvalidSampleCount if n_fine == 0 or coarse arrays are empty.