Herteby/simplex-noise/1.0.0

NOTE: the latest version is 1.2.2

Simplex

This is a library to generate simplex noise in Elm.

The code is a port of the simplex noise JavaScript version by Jonas Wagner.

Example usage

( perm, newSeed ) =
    permutationTable (initialSeed 42)


-- generate the permutation table
noiseValue =
    noise3d perm 1 1 1

Permutation tables

type alias PermutationTable =
{ perm : Array Int
, permMod12 : Array Int
}

Permutation table that is needed to generate the noise value.

permutationTableGenerator : Generator PermutationTable

Generate the permutation tables that are needed to calculate the noise value.

permutationTableFromInt : Int -> PermutationTable

Convenience function to generate a PermutationTable using an Int as a seed

Genarate noise

noise4d : PermutationTable -> Float -> Float -> Float -> Float -> Float

Generates a noise value between -1 and 1 based on the given x, y, z and w value and a seeded permutation table.

noise3d : PermutationTable -> Float -> Float -> Float -> Float

Generates a noise value between -1 and 1 based on the given x, y and z value and a seeded permutation table.

noise2d : PermutationTable -> Float -> Float -> Float

Generates a noise value between -1 and 1 based on the given x and y value and a seeded permutation table.