SimplexNoise.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>SimplexNoise - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <h1 translate="no">SimplexNoise</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>A utility class providing noise functions.</p>
  16. <p>The code is based on <a href="https://web.archive.org/web/20210210162332/http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf" target="_blank" rel="noopener">Simplex noise demystified</a>
  17. by Stefan Gustavson, 2005.</p></div>
  18. </header>
  19. <article>
  20. <h2 class="subsection-title">Import</h2>
  21. <p><span translate="no">SimplexNoise</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank" rel="noopener">Installation#Addons</a>.</p>
  22. <pre><code class="language-js">import { SimplexNoise } from 'three/addons/math/SimplexNoise.js';</code></pre>
  23. <div class="container-overview">
  24. <h2>Constructor</h2>
  25. <h3 class="name name-method" id="SimplexNoise" translate="no">new <a href="#SimplexNoise">SimplexNoise</a><span class="signature">( r : <span class="param-type">Object</span> )</span> </h3>
  26. <div class="method">
  27. <div class="description">
  28. <p>Constructs a new simplex noise object.</p>
  29. </div>
  30. <table class="params">
  31. <tbody>
  32. <tr>
  33. <td class="name">
  34. <strong>r</strong>
  35. </td>
  36. <td class="description last">
  37. <p>A math utility class that holds a <code>random()</code> method. This makes it
  38. possible to pass in custom random number generator.</p>
  39. <p>Default is <code>Math</code>.</p>
  40. </td>
  41. </tr>
  42. </tbody>
  43. </table>
  44. </div>
  45. </div>
  46. <h2 class="subsection-title">Methods</h2>
  47. <h3 class="name name-method" id="noise" translate="no">.<a href="#noise">noise</a><span class="signature">( xin : <span class="param-type">number</span>, yin : <span class="param-type">number</span> )</span><span class="type-signature"> : number</span> </h3>
  48. <div class="method">
  49. <div class="description">
  50. <p>A 2D simplex noise method.</p>
  51. </div>
  52. <table class="params">
  53. <tbody>
  54. <tr>
  55. <td class="name">
  56. <strong>xin</strong>
  57. </td>
  58. <td class="description last">
  59. <p>The x coordinate.</p>
  60. </td>
  61. </tr>
  62. <tr>
  63. <td class="name">
  64. <strong>yin</strong>
  65. </td>
  66. <td class="description last">
  67. <p>The y coordinate.</p>
  68. </td>
  69. </tr>
  70. </tbody>
  71. </table>
  72. <dl class="details">
  73. <dt class="tag-returns"><strong>Returns:</strong> The noise value.</dt>
  74. </dl>
  75. </div>
  76. <h3 class="name name-method" id="noise3d" translate="no">.<a href="#noise3d">noise3d</a><span class="signature">( xin : <span class="param-type">number</span>, yin : <span class="param-type">number</span>, zin : <span class="param-type">number</span> )</span><span class="type-signature"> : number</span> </h3>
  77. <div class="method">
  78. <div class="description">
  79. <p>A 3D simplex noise method.</p>
  80. </div>
  81. <table class="params">
  82. <tbody>
  83. <tr>
  84. <td class="name">
  85. <strong>xin</strong>
  86. </td>
  87. <td class="description last">
  88. <p>The x coordinate.</p>
  89. </td>
  90. </tr>
  91. <tr>
  92. <td class="name">
  93. <strong>yin</strong>
  94. </td>
  95. <td class="description last">
  96. <p>The y coordinate.</p>
  97. </td>
  98. </tr>
  99. <tr>
  100. <td class="name">
  101. <strong>zin</strong>
  102. </td>
  103. <td class="description last">
  104. <p>The z coordinate.</p>
  105. </td>
  106. </tr>
  107. </tbody>
  108. </table>
  109. <dl class="details">
  110. <dt class="tag-returns"><strong>Returns:</strong> The noise value.</dt>
  111. </dl>
  112. </div>
  113. <h3 class="name name-method" id="noise4d" translate="no">.<a href="#noise4d">noise4d</a><span class="signature">( x : <span class="param-type">number</span>, y : <span class="param-type">number</span>, z : <span class="param-type">number</span>, w : <span class="param-type">number</span> )</span><span class="type-signature"> : number</span> </h3>
  114. <div class="method">
  115. <div class="description">
  116. <p>A 4D simplex noise method.</p>
  117. </div>
  118. <table class="params">
  119. <tbody>
  120. <tr>
  121. <td class="name">
  122. <strong>x</strong>
  123. </td>
  124. <td class="description last">
  125. <p>The x coordinate.</p>
  126. </td>
  127. </tr>
  128. <tr>
  129. <td class="name">
  130. <strong>y</strong>
  131. </td>
  132. <td class="description last">
  133. <p>The y coordinate.</p>
  134. </td>
  135. </tr>
  136. <tr>
  137. <td class="name">
  138. <strong>z</strong>
  139. </td>
  140. <td class="description last">
  141. <p>The z coordinate.</p>
  142. </td>
  143. </tr>
  144. <tr>
  145. <td class="name">
  146. <strong>w</strong>
  147. </td>
  148. <td class="description last">
  149. <p>The w coordinate.</p>
  150. </td>
  151. </tr>
  152. </tbody>
  153. </table>
  154. <dl class="details">
  155. <dt class="tag-returns"><strong>Returns:</strong> The noise value.</dt>
  156. </dl>
  157. </div>
  158. <h2 class="subsection-title">Source</h2>
  159. <p>
  160. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/math/SimplexNoise.js" translate="no" target="_blank" rel="noopener">examples/jsm/math/SimplexNoise.js</a>
  161. </p>
  162. </article>
  163. </section>
  164. <script src="../scripts/linenumber.js"></script>
  165. <script src="../scripts/page.js"></script>
  166. </body>
  167. </html>
粤ICP备19079148号