Rust library for sampling a Poisson disk distribution in multiple dimensions.

The Poisson disk distribution produces samples of which no two samples are too close to each other. This results in a more uniform distribution than from pure random sampling.

This library is an implementation of the algorithm introduced by Robert Bridson [1] which is O(N) for producing N samples. That is, the sampling time increases linearly with the number of produced samples. For two-dimensional sampling, the sampling time increases with the area and for three-dimensional sampling with the volume.

Examples

Three dimensions

```rust use poisson_diskus::bridson;

let boxsize = [3.0, 5.0, 7.0]; let rmin = 0.5; let numattempts = 30;

let coords = bridson(&boxsize, rmin, numattempts).unwrap(); ```

Larger number of dimensions

```rust use poisson_diskus::bridson;

let boxsize = [3.0, 5.0, 3.0, 2.0, 1.0]; let rmin = 1.0; let numattempts = 30;

let coords = bridson(&boxsize, rmin, numattempts).unwrap();

for coord in coords { asserteq!(coord.len(), boxsize.len()); } ```

Citations

[1] Bridson, R. (2007). Fast Poisson disk sampling in arbitrary dimensions. SIGGRAPH sketches, 10, 1.

License

This library is offered under the permissive Blue Oak license. See LICENSE.md for more details.