TorusKnotGeometry.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>TorusKnotGeometry - 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">TorusKnotGeometry</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>Creates a torus knot, the particular shape of which is defined by a pair
  17. of coprime integers, p and q. If p and q are not coprime, the result will
  18. be a torus link.</p></div>
  19. <iframe id="viewer" src="../scenes/geometry-browser.html#TorusKnotGeometry"></iframe>
  20. <h2>Code Example</h2>
  21. <div translate="no"><pre><code class="language-js">const geometry = new THREE.TorusKnotGeometry( 10, 3, 100, 16 );
  22. const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
  23. const torusKnot = new THREE.Mesh( geometry, material );
  24. scene.add( torusKnot );
  25. </code></pre></div>
  26. </header>
  27. <article>
  28. <div class="container-overview">
  29. <h2>Constructor</h2>
  30. <h3 class="name name-method" id="TorusKnotGeometry" translate="no">new <a href="#TorusKnotGeometry">TorusKnotGeometry</a><span class="signature">( radius : <span class="param-type">number</span>, tube : <span class="param-type">number</span>, tubularSegments : <span class="param-type">number</span>, radialSegments : <span class="param-type">number</span>, p : <span class="param-type">number</span>, q : <span class="param-type">number</span> )</span> </h3>
  31. <div class="method">
  32. <div class="description">
  33. <p>Constructs a new torus knot geometry.</p>
  34. </div>
  35. <table class="params">
  36. <tbody>
  37. <tr>
  38. <td class="name"><code>radius</code></td>
  39. <td class="description last"><p>Radius of the torus knot.<br/>Default is <code>1</code>.</p></td>
  40. </tr>
  41. <tr>
  42. <td class="name"><code>tube</code></td>
  43. <td class="description last"><p>Radius of the tube.<br/>Default is <code>0.4</code>.</p></td>
  44. </tr>
  45. <tr>
  46. <td class="name"><code>tubularSegments</code></td>
  47. <td class="description last"><p>The number of tubular segments.<br/>Default is <code>64</code>.</p></td>
  48. </tr>
  49. <tr>
  50. <td class="name"><code>radialSegments</code></td>
  51. <td class="description last"><p>The number of radial segments.<br/>Default is <code>8</code>.</p></td>
  52. </tr>
  53. <tr>
  54. <td class="name"><code>p</code></td>
  55. <td class="description last"><p>This value determines, how many times the geometry winds around its axis of rotational symmetry.<br/>Default is <code>2</code>.</p></td>
  56. </tr>
  57. <tr>
  58. <td class="name"><code>q</code></td>
  59. <td class="description last"><p>This value determines, how many times the geometry winds around a circle in the interior of the torus.<br/>Default is <code>3</code>.</p></td>
  60. </tr>
  61. </tbody>
  62. </table>
  63. </div>
  64. </div>
  65. <h2 class="subsection-title">Properties</h2>
  66. <div class="member">
  67. <h3 class="name" id="parameters" translate="no">.<a href="#parameters">parameters</a><span class="type-signature"> : Object</span> </h3>
  68. <div class="description">
  69. <p>Holds the constructor parameters that have been
  70. used to generate the geometry. Any modification
  71. after instantiation does not change the geometry.</p>
  72. </div>
  73. </div>
  74. <h2 class="subsection-title">Static Methods</h2>
  75. <h3 class="name name-method" id=".fromJSON" translate="no">.<a href="#.fromJSON">fromJSON</a><span class="signature">( data : <span class="param-type">Object</span> )</span><span class="type-signature"> : <a href="TorusKnotGeometry.html">TorusKnotGeometry</a></span> </h3>
  76. <div class="method">
  77. <div class="description">
  78. <p>Factory method for creating an instance of this class from the given
  79. JSON object.</p>
  80. </div>
  81. <table class="params">
  82. <tbody>
  83. <tr>
  84. <td class="name"><code>data</code></td>
  85. <td class="description last"><p>A JSON object representing the serialized geometry.</p></td>
  86. </tr>
  87. </tbody>
  88. </table>
  89. <dl class="details">
  90. <dt class="tag-returns"><strong>Returns:</strong> A new instance.</dt>
  91. </dl>
  92. </div>
  93. <h2 class="subsection-title">Source</h2>
  94. <p>
  95. <a href="https://github.com/mrdoob/three.js/blob/master/src/geometries/TorusKnotGeometry.js" target="_blank" rel="noopener" translate="no">src/geometries/TorusKnotGeometry.js</a>
  96. </p>
  97. </article>
  98. </section>
  99. <script src="../scripts/linenumber.js"></script>
  100. <script src="../scripts/page.js"></script>
  101. </body>
  102. </html>
粤ICP备19079148号