Crates.io | dynamic_poisson_sampling |
lib.rs | dynamic_poisson_sampling |
version | 1.0.0 |
source | src |
created_at | 2024-04-23 07:59:29.964659 |
updated_at | 2024-04-23 07:59:29.964659 |
description | A poisson disk sampling with dynamic distance. |
homepage | |
repository | https://github.com/Nathan-M-code/dynamic_poisson_sampling |
max_upload_size | |
id | 1217269 |
size | 245,889 |
A slow poisson disk sampling with dynamic distance written in Rust.
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.)
}
});