ParametricGeometry.html 4.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>ParametricGeometry - 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. <p class="inheritance" translate="no"><a href="EventDispatcher.html">EventDispatcher</a> → <a href="BufferGeometry.html">BufferGeometry</a> → </p>
  13. <h1 translate="no">ParametricGeometry</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>This class can be used to generate a geometry based on a parametric surface.</p>
  17. <p>Reference: <a href="https://prideout.net/blog/old/blog/index.html@p=44.html">Mesh Generation with Python</a></p></div>
  18. <h2>Code Example</h2>
  19. <div translate="no"><pre><code class="language-js">const geometry = new THREE.ParametricGeometry( klein, 25, 25 );
  20. const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
  21. const klein = new THREE.Mesh( geometry, material );
  22. scene.add( klein );
  23. </code></pre></div>
  24. </header>
  25. <article>
  26. <h2 class="subsection-title">Import</h2>
  27. <p><span translate="no">ParametricGeometry</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank">Installation#Addons</a>.</p>
  28. <pre><code class="language-js">import { ParametricGeometry } from 'three/addons/geometries/ParametricGeometry.js';</code></pre>
  29. <div class="container-overview">
  30. <h2>Constructor</h2>
  31. <h3 class="name name-method" id="ParametricGeometry" translate="no">new <a href="#ParametricGeometry">ParametricGeometry</a><span class="signature">( func : <span class="param-type">ParametricGeometry~Func</span>, slices : <span class="param-type">number</span>, stacks : <span class="param-type">number</span> )</span> </h3>
  32. <div class="method">
  33. <div class="description">
  34. <p>Constructs a new parametric geometry.</p>
  35. </div>
  36. <table class="params">
  37. <tbody>
  38. <tr>
  39. <td class="name"><code>func</code></td>
  40. <td class="description last"><p>The parametric function. Default is a function that generates a curved plane surface.</p></td>
  41. </tr>
  42. <tr>
  43. <td class="name"><code>slices</code></td>
  44. <td class="description last"><p>The number of slices to use for the parametric function.<br/>Default is <code>8</code>.</p></td>
  45. </tr>
  46. <tr>
  47. <td class="name"><code>stacks</code></td>
  48. <td class="description last"><p>The stacks of slices to use for the parametric function.<br/>Default is <code>8</code>.</p></td>
  49. </tr>
  50. </tbody>
  51. </table>
  52. </div>
  53. </div>
  54. <h2 class="subsection-title">Properties</h2>
  55. <div class="member">
  56. <h3 class="name" id="parameters" translate="no">.<a href="#parameters">parameters</a><span class="type-signature"> : Object</span> </h3>
  57. <div class="description">
  58. <p>Holds the constructor parameters that have been
  59. used to generate the geometry. Any modification
  60. after instantiation does not change the geometry.</p>
  61. </div>
  62. </div>
  63. <h2 class="subsection-title">Type Definitions</h2>
  64. <h3 class="name name-method" id="~Func" translate="no">.<a href="#~Func">Func</a><span class="signature">( u : <span class="param-type">number</span>, v : <span class="param-type">number</span>, target : <span class="param-type">Vector3</span> )</span> </h3>
  65. <div class="method">
  66. <div class="description">
  67. <p>Parametric function definition of <code>ParametricGeometry</code>.</p>
  68. </div>
  69. <table class="params">
  70. <tbody>
  71. <tr>
  72. <td class="name"><code>u</code></td>
  73. <td class="description last"><p>The <code>u</code> coordinate on the surface in the range <code>[0,1]</code>.</p></td>
  74. </tr>
  75. <tr>
  76. <td class="name"><code>v</code></td>
  77. <td class="description last"><p>The <code>v</code> coordinate on the surface in the range <code>[0,1]</code>.</p></td>
  78. </tr>
  79. <tr>
  80. <td class="name"><code>target</code></td>
  81. <td class="description last"><p>The target vector that is used to store the method's result.</p></td>
  82. </tr>
  83. </tbody>
  84. </table>
  85. </div>
  86. <h2 class="subsection-title">Source</h2>
  87. <p>
  88. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/geometries/ParametricGeometry.js" target="_blank" rel="noopener" translate="no">examples/jsm/geometries/ParametricGeometry.js</a>
  89. </p>
  90. </article>
  91. </section>
  92. <script src="../scripts/linenumber.js"></script>
  93. <script src="../scripts/page.js"></script>
  94. </body>
  95. </html>
粤ICP备19079148号