bridson

Function bridson 

Source
pub fn bridson<const D: usize>(
    box_size: &[f64; D],
    rmin: f64,
    num_attempts: usize,
    use_pbc: bool,
) -> Result<Vec<[f64; D]>, Error<D>>
Expand description

Generate samples from a Poisson disc distribution within the given box.

The box_size array may have any non-zero dimension D. Samples are generated with this dimension and are separated from each other by a minimum distance rmin. A set number of attempts num_attempts is made for each sample candidate (30 is suggested as a good value by Bridson, but this can be increased to produce tighter samples).

This function uses rand::thread_rng() as a random number generator. To use another generator, use the bridson_rng function.

ยงPeriodic boundary conditions

If use_pbc is set to true the algorithm will look for neighbours across the periodic borders of the grid. This is slightly slower: about 25% to 35%, for the same number of generated points.