#sampling #multi-dimensional #distribution #poisson-disk

dynamic_poisson_sampling

A poisson disk sampling with dynamic distance

1 stable release

1.0.0 Apr 23, 2024

#625 in Science

MIT license

160KB
67 lines

dynamic_poisson_sampling

A slow poisson disk sampling with dynamic distance written in Rust.

Example

let bounds = (0., 0., size_noise.0 as f64, size_noise.1 as f64);
let points = get_points(12, (size_noise.0 as f64/2f64, size_noise.1 as f64/2f64).into(), &mut rng, |pos|{
    if pos[0] < bounds.0 || pos[0] >= bounds.0+bounds.2 || pos[1] < bounds.1 || pos[1] >= bounds.1+bounds.3 {
        None
    }else{
        Some(3. + noise_height.get_pixel(pos[0] as u32, pos[1] as u32).0[0] as f64/255. * 10.)
    }
});

Result

Alt text


lib.rs:

dynamic_poisson_sampling is a very simple crate that allows using poisson sampling with dynamic distance.

Dependencies

~310KB