Struct poisson::PoissonDisk
[−]
[src]
pub struct PoissonDisk<R> where R: Rng {
// some fields omitted
}
Generates Poisson-disk distribution in [0, 1]² area with O(N) time and space complexity relative to the number of samples generated. Based on Ebeida, Mohamed S., et al. "A Simple Algorithm for Maximal Poisson‐Disk Sampling in High Dimensions." Computer Graphics Forum. Vol. 31. No. 2pt4. Blackwell Publishing Ltd, 2012.
Examples
extern crate poisson; extern crate rand; extern crate nalgebra as na; type Vec2 = na::Vec2<f64>; use poisson::PoissonDisk; fn main() { let mut poisson = PoissonDisk::new(rand::weak_rng()).build_radius::<Vec2>(0.1); let vecs = poisson.generate(); println!("{:?}", vecs); }
Methods
impl<R> PoissonDisk<R> where R: Rng
[src]
fn new(rand: R) -> Self
Creates new Poisson-disk generator builder with random generator specified.
fn perioditic(self) -> Self
Sets the generator to generate perioditic Poisson-disk distributions.
fn build_relative_radius<V>(self, radius: f64) -> PoissonGen<R, V> where V: VecLike
Builds the generator with relative radius specified. Radius should be ]0, 1]
fn build_radius<V>(self, radius: f64) -> PoissonGen<R, V> where V: VecLike
Builds the generator with radius specified. Radius should be ]0, √2 / 2]
fn build_samples<V>(self, samples: u32, relative_radius: f64) -> PoissonGen<R, V> where V: VecLike
Builds the generator with radius calculated so that approximately specified number of samples are generated. Amount of samples should be larger than 0. Relative radius should be [0, 1]. For non-perioditic this is supported only for 2, 3 and 4 dimensional generation.