#noise #poisson #blue

bluenoise

Ergonomic blue noise (poisson disk sampling) for the masses

5 releases

0.2.1 Dec 17, 2021
0.2.0 Jan 23, 2021
0.1.2 Sep 3, 2020
0.1.1 Aug 17, 2020
0.1.0 Aug 16, 2020

#1068 in Filesystem


Used in cfluid

MIT/Apache

19KB
272 lines

bluenoise-rs

version license

bluenoise provides an implementation of poisson disk sampling in two dimensions, with glam as the underlying maths library. It aims to be fast, well documented and easy to use, taking advantage of a few optimisations to dramatically speed up compute speed.

Get Started

To get started, if you have cargo-edit, simply run:

cargo add bluenoise

Otherwise, add bluenoise to your Cargo.toml.

[dependencies]
bluenoise = "0.2"

lib.rs:

bluenoise-rs

bluenoise provides an implementation of poisson disk sampling in two dimensions, with glam as the underlying maths library. It aims to be fast, well documented and easy to use, taking advantage of a few optimisations to dramatically speed up compute speed.

Examples

use bluenoise::BlueNoise;
use rand_pcg::Pcg64Mcg;

let mut noise = BlueNoise::<Pcg64Mcg>::new(50.0, 50.0, 10.0);
let noise = noise.with_samples(10).with_seed(10);

for point in noise.take(10) {
    println!("{}, {}", point.x, point.y);
}
use bluenoise::WrappingBlueNoise;
use rand::SeedableRng;
use rand_pcg::Pcg64Mcg;

let mut noise = WrappingBlueNoise::from_rng(50.0, 50.0, 10.0, Pcg64Mcg::seed_from_u64(10));
let noise = noise.with_samples(10);

for point in noise.take(10) {
    println!("{}, {}", point.x, point.y);
}

Dependencies

~3.5MB
~103K SLoC