Perlin noise: Difference between revisions

remove non-breakable whitespaces
m (Aligning texr.)
(remove non-breakable whitespaces)
Line 1:
{{task}}
 
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 &nbsp; [[random numbers|pseudo-random]] &nbsp; mapping of &nbsp; <big><big><math>\R^d</math></big></big> &nbsp; into &nbsp; <big><big><math>\R</math></big></big> &nbsp; with an integer &nbsp; <big><math>d</math></big> &nbsp; which can be arbitrarily large but which is usually &nbsp; 2, &nbsp; 3, &nbsp; or &nbsp; 4.
 
Either by using a dedicated library or by implementing the algorithm, show that the Perlin noise &nbsp; (as defined in 2002 in the Java implementation below) &nbsp; of the point in 3D-space with coordinates &nbsp; &nbsp; 3.14, &nbsp; 42, &nbsp; 7 &nbsp; &nbsp; is &nbsp; &nbsp; 0.13691995878400012.
 
Either by using a dedicated library or by implementing the algorithm, show that the Perlin noise &nbsp; (as defined in 2002 in the Java implementation below) &nbsp; of the point in 3D-space with coordinates &nbsp; &nbsp; 3.14, &nbsp; 42, &nbsp; 7 &nbsp; &nbsp; is &nbsp; &nbsp; 0.13691995878400012.
 
''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 ⟶ 2,145:
=={{header|REXX}}==
{{trans|Go}}
Programming note: &nbsp; the REXX operator &nbsp; <big><b> '''//''' </b></big> &nbsp; is the remainder for division &nbsp; (not modulus), &nbsp; so the absolute value of the
<br>remainder is used for this task.
 
Line 2,196 ⟶ 2,195:
lerp(u, grad( pick(ab+1), x , ym, zm ), ,
grad( pick(bb+1), xm, ym, zm )))) /1</syntaxhighlight>
{{out|output|text=&nbsp; when using the internal default inputs:}}
 
(Output note: &nbsp; this REXX program uses '''100''' decimal digit precision, but '''20''' decimal digits would've been adequate.)
 
(Note that REXX uses &nbsp; ''decimal'' &nbsp; floating point, &nbsp; not binary.)
<pre>
Perlin noise for the 3D point [3.14 42 7] ───► 0.136919958784
1,934

edits