#simplex-noise #perlin-noise #2d-3d #java #public #described #domain

simplex-23d-rs

在Rust中使用Simplex 2D/3D噪声

3个不稳定发布

0.2.1 2023年10月31日
0.2.0 2023年10月31日
0.1.0 2023年10月31日

#666数学

MIT/Apache

6.5MB
328

Simplex 2D / 3D in Rust

License Crates.io

提供基本的2D和3D Simplex噪声函数。

此Rust版本是从这里描述的公有领域Java实现移植过来的

Simplex噪声揭秘 Stefan Gustavson,瑞典林雪平大学,2005-03-22

用法

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);

Simplex对象使用给定的种子值通过rand crate生成一个排列表。对于频率,只需将其与输入坐标相乘即可

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

可视化

simplex noise 2d

simplex noise 3d

更新日志

  • 0.2.1修复perm_mod12优化
  • 0.2.0更新readme
  • 0.1.0首次发布

依赖项