noise
Simplex noise (like Perlin) for CircuitPython.
Author(s): Tod Kurt
Implementation Notes
A basic port of https://weber.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf Also see: https://github.com/stegu/perlin-noise/blob/master/src/simplexnoise1234.c
Optimised for CircuitPython/MicroPython by:
F2, G2, and the x2/y2 offset are pre-computed constants (no math.sqrt at startup)
floor()is inlined, avoiding two function calls pernoise()invocationdot()is inlined via_gx/_gytuples, avoiding per-call function and attribute lookups
Also works in desktop CPython.
- class noise.Grad(x, y, z)
Holder for 3D grad. Used internally by noise()
- noise.dot(grad, x, y)
Compute dot product of grad against x,y. Used internally by noise()
- noise.noise(xin, yin=0)
2D SimplexNoise
- noise.noise_init()
Initialize permutation arrays. Done automatically on module load