SimplexNoise.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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">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">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"><code>r</code></td>
  34. <td class="description last"><p>A math utility class that holds a <code>random()</code> method. This makes it
  35. possible to pass in custom random number generator.<br/>Default is <code>Math</code>.</p></td>
  36. </tr>
  37. </tbody>
  38. </table>
  39. </div>
  40. </div>
  41. <h2 class="subsection-title">Methods</h2>
  42. <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>
  43. <div class="method">
  44. <div class="description">
  45. <p>A 2D simplex noise method.</p>
  46. </div>
  47. <table class="params">
  48. <tbody>
  49. <tr>
  50. <td class="name"><code>xin</code></td>
  51. <td class="description last"><p>The x coordinate.</p></td>
  52. </tr>
  53. <tr>
  54. <td class="name"><code>yin</code></td>
  55. <td class="description last"><p>The y coordinate.</p></td>
  56. </tr>
  57. </tbody>
  58. </table>
  59. <dl class="details">
  60. <dt class="tag-returns"><strong>Returns:</strong> The noise value.</dt>
  61. </dl>
  62. </div>
  63. <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>
  64. <div class="method">
  65. <div class="description">
  66. <p>A 3D simplex noise method.</p>
  67. </div>
  68. <table class="params">
  69. <tbody>
  70. <tr>
  71. <td class="name"><code>xin</code></td>
  72. <td class="description last"><p>The x coordinate.</p></td>
  73. </tr>
  74. <tr>
  75. <td class="name"><code>yin</code></td>
  76. <td class="description last"><p>The y coordinate.</p></td>
  77. </tr>
  78. <tr>
  79. <td class="name"><code>zin</code></td>
  80. <td class="description last"><p>The z coordinate.</p></td>
  81. </tr>
  82. </tbody>
  83. </table>
  84. <dl class="details">
  85. <dt class="tag-returns"><strong>Returns:</strong> The noise value.</dt>
  86. </dl>
  87. </div>
  88. <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>
  89. <div class="method">
  90. <div class="description">
  91. <p>A 4D simplex noise method.</p>
  92. </div>
  93. <table class="params">
  94. <tbody>
  95. <tr>
  96. <td class="name"><code>x</code></td>
  97. <td class="description last"><p>The x coordinate.</p></td>
  98. </tr>
  99. <tr>
  100. <td class="name"><code>y</code></td>
  101. <td class="description last"><p>The y coordinate.</p></td>
  102. </tr>
  103. <tr>
  104. <td class="name"><code>z</code></td>
  105. <td class="description last"><p>The z coordinate.</p></td>
  106. </tr>
  107. <tr>
  108. <td class="name"><code>w</code></td>
  109. <td class="description last"><p>The w coordinate.</p></td>
  110. </tr>
  111. </tbody>
  112. </table>
  113. <dl class="details">
  114. <dt class="tag-returns"><strong>Returns:</strong> The noise value.</dt>
  115. </dl>
  116. </div>
  117. <h2 class="subsection-title">Source</h2>
  118. <p>
  119. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/math/SimplexNoise.js" target="_blank" rel="noopener" translate="no">examples/jsm/math/SimplexNoise.js</a>
  120. </p>
  121. </article>
  122. </section>
  123. <script src="../scripts/linenumber.js"></script>
  124. <script src="../scripts/page.js"></script>
  125. </body>
  126. </html>
粤ICP备19079148号