Perlin noise: Difference between revisions
Content added Content deleted
m (Aligning texr.) |
(remove non-breakable whitespaces) |
||
Line 1: | Line 1: | ||
{{task}} |
{{task}} |
||
The |
The '''[[wp:Perlin noise|Perlin noise]]''' is a kind of [[wp:gradient noise|gradient noise]] invented by [[wp:Ken Perlin|Ken Perlin]] around the end of the twentieth century and still currently heavily used in [[wp:computer graphics|computer graphics]], most notably to procedurally generate textures or heightmaps. |
||
The Perlin noise is basically a |
The Perlin noise is basically a [[random numbers|pseudo-random]] mapping of <big><big><math>\R^d</math></big></big> into <big><big><math>\R</math></big></big> with an integer <big><math>d</math></big> which can be arbitrarily large but which is usually 2, 3, or 4. |
||
⚫ | |||
⚫ | |||
''Note: this result assumes 64 bit IEEE-754 floating point calculations. If your language uses a different floating point representation, make a note of it and calculate the value accurate to 15 decimal places, or your languages accuracy threshold if it is less. Trailing zeros need not be displayed.'' |
''Note: this result assumes 64 bit IEEE-754 floating point calculations. If your language uses a different floating point representation, make a note of it and calculate the value accurate to 15 decimal places, or your languages accuracy threshold if it is less. Trailing zeros need not be displayed.'' |
||
Line 2,146: | Line 2,145: | ||
=={{header|REXX}}== |
=={{header|REXX}}== |
||
{{trans|Go}} |
{{trans|Go}} |
||
Programming note: |
Programming note: the REXX operator <big><b> '''//''' </b></big> is the remainder for division (not modulus), so the absolute value of the |
||
<br>remainder is used for this task. |
<br>remainder is used for this task. |
||
Line 2,196: | Line 2,195: | ||
lerp(u, grad( pick(ab+1), x , ym, zm ), , |
lerp(u, grad( pick(ab+1), x , ym, zm ), , |
||
grad( pick(bb+1), xm, ym, zm )))) /1</syntaxhighlight> |
grad( pick(bb+1), xm, ym, zm )))) /1</syntaxhighlight> |
||
{{out|output|text= |
{{out|output|text=when using the internal default inputs:}} |
||
(Output note: |
(Output note: this REXX program uses '''100''' decimal digit precision, but '''20''' decimal digits would've been adequate.) |
||
(Note that REXX uses |
(Note that REXX uses ''decimal'' floating point, not binary.) |
||
<pre> |
<pre> |
||
Perlin noise for the 3D point [3.14 42 7] ───► 0.136919958784 |
Perlin noise for the 3D point [3.14 42 7] ───► 0.136919958784 |