A simple to use perlin noise module for typescript.
The class that handles PerlinNoise generation.
const perlin = new PerlinNoise(permuation?: numbers[])
permutiation
(numbers[]) is an optional parameter to set the permutations used by the system
perlin.noise(x: number, y: number, z: number, min?: number, max?: number)
x
(number) X cordinate
y
(number) X cordinate
z
(number) X cordinate
min
(number) not required, default 0. Minium value generated.
max
(number) not required, default 1. Maxium value generated
Will return a perlin noise random value between min and max
import {PerlinNoise} from 'https://deno.land/x/perlinnoise/mod.ts';
const perlin = new PerlinNoise();
console.log(perlin.noise(0.1, 0.1, 0.1));
This is a port of Kas Thomas' javascript function which is a port of Ken Perlin's Java code. Kas Thomas' code can be found at https://asserttrue.blogspot.com/2011/12/perlin-noise-in-javascript_31.html Ken Perlin's code can be found at http://cs.nyu.edu/%7Eperlin/noise/ So really most of the work was done by them, I simply ported Kas' version to typescript by adding a few types to the functions