Expand description
§faster_poisson
This is a library that implements various methods of Poisson disk sampling.
Each method returns a set of points where no two are less than a fixed distance from each other.
§Usage
The easiest way to use this library is with the Poisson2D, Poisson3D, and PoissonND types.
You can generate points all at once with the run method, or lazily with the iter method.
To change parameters like the grid dimensions or minimum distance, Poisson uses a fluent interface pattern.
use faster_poisson::{Poisson2D, Poisson3D, PoissonND};
// Sample points from a 6 x 4 grid with minimum distance 0.5.
let poisson_2d = Poisson2D::new().dims([6.0, 4.0]).radius(0.5);
let samples_2d = poisson_2d.run();
// The default side length of the grid is 1.0 and the default radius is 0.1.
let poisson_3d = Poisson3D::new();
let samples_3d = poisson_3d.run();
// For dimensions higher than 3, use PoissonND.
let poisson_4d = PoissonND::<4>::new();
// Points are generated lazily, so this is fast.
let samples_4d_100: Vec<[f64; 4]> = poisson_4d.iter().take(100).collect();For smaller 2D grids (< 1,000,000 points) it is probably faster to use PoissonDart2D.
§Features
-
gpuUse the wgpu crate to perform Poisson disk sampling on the GPU with
pixelpie::PoissonPixelPie. -
plotlyUse the plotly crate to plot distributions with
plot::plot_2dandplot::plot_3d. -
fourierUse the rustfft crate to generate 2D periodograms of distributions with
fourier::fourier.
-
stippleStipple images with
stipple::stipple_image_lumaandstipple::stipple_image_rgb.

Modules§
- bridson
- Improves upon the algorithm from Robert Bridson’s Fast Poisson Disk Sampling in Arbitrary Dimensions
- common
- dart
- Implements an improved dart throwing algorithm.
- fourier
- naive
- Implements a slightly optimized naive dart throwing algorithm.
- pixelpie
- plot
- regular
- Generates a regular grid of points with exactly
radiusbetween each of them. - stipple
Structs§
- Poisson
- Generates Poisson disk samples.