CapsuleGeometry.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>CapsuleGeometry - 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">CapsuleGeometry</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A geometry class for representing a capsule.</p></div>
  17. <iframe id="viewer" src="../scenes/geometry-browser.html#CapsuleGeometry"></iframe>
  18. <h2>Code Example</h2>
  19. <div translate="no"><pre><code class="language-js">const geometry = new THREE.CapsuleGeometry( 1, 1, 4, 8, 1 );
  20. const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
  21. const capsule = new THREE.Mesh( geometry, material );
  22. scene.add( capsule );
  23. </code></pre></div>
  24. </header>
  25. <article>
  26. <div class="container-overview">
  27. <h2>Constructor</h2>
  28. <h3 class="name name-method" id="CapsuleGeometry" translate="no">new <a href="#CapsuleGeometry">CapsuleGeometry</a><span class="signature">( radius : <span class="param-type">number</span>, height : <span class="param-type">number</span>, capSegments : <span class="param-type">number</span>, radialSegments : <span class="param-type">number</span>, heightSegments : <span class="param-type">number</span> )</span> </h3>
  29. <div class="method">
  30. <div class="description">
  31. <p>Constructs a new capsule geometry.</p>
  32. </div>
  33. <table class="params">
  34. <tbody>
  35. <tr>
  36. <td class="name">
  37. <strong>radius</strong>
  38. </td>
  39. <td class="description last">
  40. <p>Radius of the capsule.</p>
  41. <p>Default is <code>1</code>.</p>
  42. </td>
  43. </tr>
  44. <tr>
  45. <td class="name">
  46. <strong>height</strong>
  47. </td>
  48. <td class="description last">
  49. <p>Height of the middle section.</p>
  50. <p>Default is <code>1</code>.</p>
  51. </td>
  52. </tr>
  53. <tr>
  54. <td class="name">
  55. <strong>capSegments</strong>
  56. </td>
  57. <td class="description last">
  58. <p>Number of curve segments used to build each cap.</p>
  59. <p>Default is <code>4</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 capsule. Must be an integer &gt;= 3.</p>
  68. <p>Default is <code>8</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 middle section. Must be an integer &gt;= 1.</p>
  77. <p>Default is <code>1</code>.</p>
  78. </td>
  79. </tr>
  80. </tbody>
  81. </table>
  82. </div>
  83. </div>
  84. <h2 class="subsection-title">Properties</h2>
  85. <div class="member">
  86. <h3 class="name" id="parameters" translate="no">.<a href="#parameters">parameters</a><span class="type-signature"> : Object</span> </h3>
  87. <div class="description">
  88. <p>Holds the constructor parameters that have been
  89. used to generate the geometry. Any modification
  90. after instantiation does not change the geometry.</p>
  91. </div>
  92. </div>
  93. <h2 class="subsection-title">Static Methods</h2>
  94. <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="CapsuleGeometry.html">CapsuleGeometry</a></span> </h3>
  95. <div class="method">
  96. <div class="description">
  97. <p>Factory method for creating an instance of this class from the given
  98. JSON object.</p>
  99. </div>
  100. <table class="params">
  101. <tbody>
  102. <tr>
  103. <td class="name">
  104. <strong>data</strong>
  105. </td>
  106. <td class="description last">
  107. <p>A JSON object representing the serialized geometry.</p>
  108. </td>
  109. </tr>
  110. </tbody>
  111. </table>
  112. <dl class="details">
  113. <dt class="tag-returns"><strong>Returns:</strong> A new instance.</dt>
  114. </dl>
  115. </div>
  116. <h2 class="subsection-title">Source</h2>
  117. <p>
  118. <a href="https://github.com/mrdoob/three.js/blob/master/src/geometries/CapsuleGeometry.js" translate="no" target="_blank" rel="noopener">src/geometries/CapsuleGeometry.js</a>
  119. </p>
  120. </article>
  121. </section>
  122. <script src="../scripts/linenumber.js"></script>
  123. <script src="../scripts/page.js"></script>
  124. </body>
  125. </html>
粤ICP备19079148号