sdnoise
Constants
- grad2lut :
Int8Array
Gradient tables. These could be programmed the Ken Perlin way with some clever bit-twiddling, but this is more clear, and not really slower.
PORT NOTES: static float grad2lut[8][2]
- grad3lut :
Int8Array
Gradient directions for 3D. These vectors are based on the midpoints of the 12 edges of a cube. A larger array of random unit length vectors would also do the job, but these 12 (including 4 repeats to make the array length a power of two) work better. They are not random, they are carefully chosen to represent a small, isotropic set of directions.
PORT NOTES: static float grad3lut[16][3]
- grad4lut :
Int8Array
PORT NOTES: static float grad3lut[32][4]
- simplex :
Uint8Array
A lookup table to traverse the simplex around a given point in 4D. Details can be found where this table is used, in the 4D noise method. TODO: This should not be required, backport it from Bill's GLSL code!
PORT NOTES: static unsigned char simplex[64][4]
Functions
- grad1(hash) ⇒
number
- grad2(result, hash)
- grad3(result, hash)
- grad4(result, hash)
- sdnoise1(x, derivatives) ⇒
number
1D simplex noise with derivative. If the last argument is not null, the analytic derivative is also calculated.
- sdnoise2(x, y, derivatives) ⇒
number
2D simplex noise with derivatives. If the last two arguments are not null, the analytic derivative (the 2D gradient of the scalar noise field) is also calculated.
- sdnoise3(x, y, z, derivatives) ⇒
number
3D simplex noise with derivatives. If the last tthree arguments are not null, the analytic derivative (the 3D gradient of the scalar noise field) is also calculated.
- sdnoise4(derivatives, x, y, z, w) ⇒
number
4D simplex noise with derivatives. If the last four arguments are not null, the analytic derivative (the 4D gradient of the scalar noise field) is also calculated.
grad2lut : Int8Array
Gradient tables. These could be programmed the Ken Perlin way with some clever bit-twiddling, but this is more clear, and not really slower.
PORT NOTES: static float grad2lut[8][2]
Kind: global constant
Read only: true
grad3lut : Int8Array
Gradient directions for 3D. These vectors are based on the midpoints of the 12 edges of a cube. A larger array of random unit length vectors would also do the job, but these 12 (including 4 repeats to make the array length a power of two) work better. They are not random, they are carefully chosen to represent a small, isotropic set of directions.
PORT NOTES: static float grad3lut[16][3]
Kind: global constant
Read only: true
grad4lut : Int8Array
PORT NOTES: static float grad3lut[32][4]
Kind: global constant
Read only: true
simplex : Uint8Array
A lookup table to traverse the simplex around a given point in 4D. Details can be found where this table is used, in the 4D noise method. TODO: This should not be required, backport it from Bill's GLSL code!
PORT NOTES: static unsigned char simplex[64][4]
Kind: global constant
Read only: true
grad1(hash) ⇒ number
Kind: global function
Param | Type |
---|---|
hash | number |
grad2(result, hash)
Kind: global function
Param | Type |
---|---|
result | Array.<number> |
hash | number |
grad3(result, hash)
Kind: global function
Param | Type |
---|---|
result | Array.<number> |
hash | number |
grad4(result, hash)
Kind: global function
Param | Type |
---|---|
result | Array.<number> |
hash | number |
sdnoise1(x, derivatives) ⇒ number
1D simplex noise with derivative. If the last argument is not null, the analytic derivative is also calculated.
Kind: global function
Param | Type |
---|---|
x | number |
derivatives | Array.<number> |
sdnoise2(x, y, derivatives) ⇒ number
2D simplex noise with derivatives. If the last two arguments are not null, the analytic derivative (the 2D gradient of the scalar noise field) is also calculated.
Kind: global function
Param | Type |
---|---|
x | number |
y | number |
derivatives | Array.<number> |
sdnoise3(x, y, z, derivatives) ⇒ number
3D simplex noise with derivatives. If the last tthree arguments are not null, the analytic derivative (the 3D gradient of the scalar noise field) is also calculated.
Kind: global function
Param | Type |
---|---|
x | number |
y | number |
z | number |
derivatives | Array.<number> |
sdnoise4(derivatives, x, y, z, w) ⇒ number
4D simplex noise with derivatives. If the last four arguments are not null, the analytic derivative (the 4D gradient of the scalar noise field) is also calculated.
Kind: global function
Param | Type |
---|---|
derivatives | Array.<number> |
x | number |
y | number |
z | number |
w | number |