Fuss - Small, lightweight simplex noise generator for Rust.
This library only provides functionality for generating 2D and 3D simplex noise, as well as the ability to normalize the noise through sum octaves (fractal Brownian motion).
Add fuss to your Cargo.toml
:
```toml [dependencies]
fuss = { git = "https://github.com/surrsurus/fuss.git" } ```
All fuss interactions happen through the Simplex
struct.
Here's how you get one:
```rust extern crate fuss; use fuss::Simplex;
let sn = Simplex::new(); ```
Simplex
lets you generate 2D and 3D noise.
rust
let sn = Simplex::new();
sn.noise_2d(1.0, -1.0);
sn.noise_3d(1.0, -1.0, 0.0);
Which lets you generate noise for large sets of points:
```rust let sn = Simplex::new();
let mut map = Vec::
Simplex
generates it's own permutation table based on the rust RNG, however you can apply your own seed to get a Simplex
as such:
```rust let sn = Simplex::fromseed(vec![0, 1, 2, 3, 4, 5]); let othersn = Simplex::from_seed(vec![0, 1, 2, 3, 4, 5]);
// The two simplexes will generate the same noise for the same points // if given the same RNG seed asserteq!(sn.noise2d(0.0, 0.0), othersn.noise2d(0.0, 0.0)); ```
Simplex
uses the same type of seeds that SeedableRng
does, being a slice of usize
s, however to make this easier Simplex
will accept a Vec<usize>
instead.
Run
bash
$ cargo test
to run all unit tests and doc tests.
This project is licensed under the MPPL 2.0 License - See the LICENSE.md file for details