CylinderGeometry.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>CylinderGeometry - 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">CylinderGeometry</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A geometry class for representing a cylinder.</p></div>
  17. <iframe id="viewer" src="../scenes/geometry-browser.html#CylinderGeometry"></iframe>
  18. <h2>Code Example</h2>
  19. <div translate="no"><pre><code class="language-js">const geometry = new THREE.CylinderGeometry( 5, 5, 20, 32 );
  20. const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
  21. const cylinder = new THREE.Mesh( geometry, material );
  22. scene.add( cylinder );
  23. </code></pre></div>
  24. </header>
  25. <article>
  26. <div class="container-overview">
  27. <h2>Constructor</h2>
  28. <h3 class="name name-method" id="CylinderGeometry" translate="no">new <a href="#CylinderGeometry">CylinderGeometry</a><span class="signature">( radiusTop : <span class="param-type">number</span>, radiusBottom : <span class="param-type">number</span>, height : <span class="param-type">number</span>, radialSegments : <span class="param-type">number</span>, heightSegments : <span class="param-type">number</span>, openEnded : <span class="param-type">boolean</span>, thetaStart : <span class="param-type">number</span>, thetaLength : <span class="param-type">number</span> )</span> </h3>
  29. <div class="method">
  30. <div class="description">
  31. <p>Constructs a new cylinder geometry.</p>
  32. </div>
  33. <table class="params">
  34. <tbody>
  35. <tr>
  36. <td class="name">
  37. <strong>radiusTop</strong>
  38. </td>
  39. <td class="description last">
  40. <p>Radius of the cylinder at the top.</p>
  41. <p>Default is <code>1</code>.</p>
  42. </td>
  43. </tr>
  44. <tr>
  45. <td class="name">
  46. <strong>radiusBottom</strong>
  47. </td>
  48. <td class="description last">
  49. <p>Radius of the cylinder at the bottom.</p>
  50. <p>Default is <code>1</code>.</p>
  51. </td>
  52. </tr>
  53. <tr>
  54. <td class="name">
  55. <strong>height</strong>
  56. </td>
  57. <td class="description last">
  58. <p>Height of the cylinder.</p>
  59. <p>Default is <code>1</code>.</p>
  60. </td>
  61. </tr>
  62. <tr>
  63. <td class="name">
  64. <strong>radialSegments</strong>
  65. </td>
  66. <td class="description last">
  67. <p>Number of segmented faces around the circumference of the cylinder.</p>
  68. <p>Default is <code>32</code>.</p>
  69. </td>
  70. </tr>
  71. <tr>
  72. <td class="name">
  73. <strong>heightSegments</strong>
  74. </td>
  75. <td class="description last">
  76. <p>Number of rows of faces along the height of the cylinder.</p>
  77. <p>Default is <code>1</code>.</p>
  78. </td>
  79. </tr>
  80. <tr>
  81. <td class="name">
  82. <strong>openEnded</strong>
  83. </td>
  84. <td class="description last">
  85. <p>Whether the base of the cylinder is open or capped.</p>
  86. <p>Default is <code>false</code>.</p>
  87. </td>
  88. </tr>
  89. <tr>
  90. <td class="name">
  91. <strong>thetaStart</strong>
  92. </td>
  93. <td class="description last">
  94. <p>Start angle for first segment, in radians.</p>
  95. <p>Default is <code>0</code>.</p>
  96. </td>
  97. </tr>
  98. <tr>
  99. <td class="name">
  100. <strong>thetaLength</strong>
  101. </td>
  102. <td class="description last">
  103. <p>The central angle, often called theta, of the circular sector, in radians.
  104. The default value results in a complete cylinder.</p>
  105. <p>Default is <code>Math.PI*2</code>.</p>
  106. </td>
  107. </tr>
  108. </tbody>
  109. </table>
  110. </div>
  111. </div>
  112. <h2 class="subsection-title">Properties</h2>
  113. <div class="member">
  114. <h3 class="name" id="parameters" translate="no">.<a href="#parameters">parameters</a><span class="type-signature"> : Object</span> </h3>
  115. <div class="description">
  116. <p>Holds the constructor parameters that have been
  117. used to generate the geometry. Any modification
  118. after instantiation does not change the geometry.</p>
  119. </div>
  120. </div>
  121. <h2 class="subsection-title">Static Methods</h2>
  122. <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="CylinderGeometry.html">CylinderGeometry</a></span> </h3>
  123. <div class="method">
  124. <div class="description">
  125. <p>Factory method for creating an instance of this class from the given
  126. JSON object.</p>
  127. </div>
  128. <table class="params">
  129. <tbody>
  130. <tr>
  131. <td class="name">
  132. <strong>data</strong>
  133. </td>
  134. <td class="description last">
  135. <p>A JSON object representing the serialized geometry.</p>
  136. </td>
  137. </tr>
  138. </tbody>
  139. </table>
  140. <dl class="details">
  141. <dt class="tag-returns"><strong>Returns:</strong> A new instance.</dt>
  142. </dl>
  143. </div>
  144. <h2 class="subsection-title">Source</h2>
  145. <p>
  146. <a href="https://github.com/mrdoob/three.js/blob/master/src/geometries/CylinderGeometry.js" translate="no" target="_blank" rel="noopener">src/geometries/CylinderGeometry.js</a>
  147. </p>
  148. </article>
  149. </section>
  150. <script src="../scripts/linenumber.js"></script>
  151. <script src="../scripts/page.js"></script>
  152. </body>
  153. </html>
粤ICP备19079148号