simplex-23d-rs

Crates.iosimplex-23d-rs
lib.rssimplex-23d-rs
version0.2.1
sourcesrc
created_at2023-10-31 04:03:30.589405
updated_at2023-10-31 07:56:04.921402
descriptionSimplex 2d/3d noise in Rust
homepage
repositoryhttps://github.com/mattzque/simplex-23d-rs
max_upload_size
id1019339
size6,691,227
Matthias Hecker (mattzque)

documentation

README

Simplex 2D / 3D in Rust

License Crates.io

Provides basic 2D and 3D simplex noise functions.

This Rust version is ported from the public domain Java implementation described here:

Simplex noise demystified Stefan Gustavson, Linköping University, Sweden (stegu@itn.liu.se), 2005-03-22

Usage

use simplex_23d::Simplex;

let seed: u64 = 42;
let noise = Simplex::new(seed);

// 2d noise
let value: f32 = noise.sample2d(1.0, 1.0);

// 3d noise
let value: f32 = noise.sample3d(1.0, 1.0, 1.0);

The Simplex object generates a permutation table using the rand crate from the given seed value. For frequency, you'd just multiply it with the input coordinate:

let freq: f32 = 0.001234;
let x: f32 = 1.0 * freq;
let y: f32 = 1.0 * freq;
let value: f32 = noise.sample2d(x, y);

Visualizations

simplex noise 2d

simplex noise 3d

Changelog

  • 0.2.1 fix perm_mod12 optimization
  • 0.2.0 updated readme
  • 0.1.0 initial release
Commit count: 5

cargo fmt