Open Simplex Noise
This is an implementation of 2D, 3D, and 4D open simplex noise in crystal.
Original work by doughsay.
Installation
Add this to your application's shard.yml
:
dependencies:
open-simplex-noise:
github: j8r/crystal-open-simplex-noise
Usage
require "open-simplex-noise"
Instantiate a noise generator using an Int64
seed:
noise = OpenSimplexNoise.new(12345_i64)
Use the generate
method, passing in either 2, 3, or 4 Float64
s to generate noise:
noise.generate(1.0, 2.0) #=> -0.08284024020120388
Documentation
https://j8r.github.io/crystal-open-simplex-noise
Examples
2D Noise:
3D Noise (2D slice):
4D Noise (2D slice):
Credits
doughsay Chris Dosé - original creator
This is mostly just a transliteration of the Python version from here: https://github.com/lmas/opensimplex, which itself is a transliteration of Kurt Spencer's original code (released to the public domain).