SphereGeometry.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>SphereGeometry - 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">SphereGeometry</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A class for generating a sphere geometry.</p></div>
  17. <iframe id="viewer" src="../scenes/geometry-browser.html#SphereGeometry"></iframe>
  18. <h2>Code Example</h2>
  19. <div translate="no"><pre><code class="language-js">const geometry = new THREE.SphereGeometry( 15, 32, 16 );
  20. const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
  21. const sphere = new THREE.Mesh( geometry, material );
  22. scene.add( sphere );
  23. </code></pre></div>
  24. </header>
  25. <article>
  26. <div class="container-overview">
  27. <h2>Constructor</h2>
  28. <h3 class="name name-method" id="SphereGeometry" translate="no">new <a href="#SphereGeometry">SphereGeometry</a><span class="signature">( radius : <span class="param-type">number</span>, widthSegments : <span class="param-type">number</span>, heightSegments : <span class="param-type">number</span>, phiStart : <span class="param-type">number</span>, phiLength : <span class="param-type">number</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 sphere 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>The sphere radius.</p>
  41. <p>Default is <code>1</code>.</p>
  42. </td>
  43. </tr>
  44. <tr>
  45. <td class="name">
  46. <strong>widthSegments</strong>
  47. </td>
  48. <td class="description last">
  49. <p>The number of horizontal segments. Minimum value is <code>3</code>.</p>
  50. <p>Default is <code>32</code>.</p>
  51. </td>
  52. </tr>
  53. <tr>
  54. <td class="name">
  55. <strong>heightSegments</strong>
  56. </td>
  57. <td class="description last">
  58. <p>The number of vertical segments. Minimum value is <code>2</code>.</p>
  59. <p>Default is <code>16</code>.</p>
  60. </td>
  61. </tr>
  62. <tr>
  63. <td class="name">
  64. <strong>phiStart</strong>
  65. </td>
  66. <td class="description last">
  67. <p>The horizontal starting angle in radians.</p>
  68. <p>Default is <code>0</code>.</p>
  69. </td>
  70. </tr>
  71. <tr>
  72. <td class="name">
  73. <strong>phiLength</strong>
  74. </td>
  75. <td class="description last">
  76. <p>The horizontal sweep angle size.</p>
  77. <p>Default is <code>Math.PI*2</code>.</p>
  78. </td>
  79. </tr>
  80. <tr>
  81. <td class="name">
  82. <strong>thetaStart</strong>
  83. </td>
  84. <td class="description last">
  85. <p>The vertical starting angle in radians.</p>
  86. <p>Default is <code>0</code>.</p>
  87. </td>
  88. </tr>
  89. <tr>
  90. <td class="name">
  91. <strong>thetaLength</strong>
  92. </td>
  93. <td class="description last">
  94. <p>The vertical sweep angle size.</p>
  95. <p>Default is <code>Math.PI</code>.</p>
  96. </td>
  97. </tr>
  98. </tbody>
  99. </table>
  100. </div>
  101. </div>
  102. <h2 class="subsection-title">Properties</h2>
  103. <div class="member">
  104. <h3 class="name" id="parameters" translate="no">.<a href="#parameters">parameters</a><span class="type-signature"> : Object</span> </h3>
  105. <div class="description">
  106. <p>Holds the constructor parameters that have been
  107. used to generate the geometry. Any modification
  108. after instantiation does not change the geometry.</p>
  109. </div>
  110. </div>
  111. <h2 class="subsection-title">Static Methods</h2>
  112. <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="SphereGeometry.html">SphereGeometry</a></span> </h3>
  113. <div class="method">
  114. <div class="description">
  115. <p>Factory method for creating an instance of this class from the given
  116. JSON object.</p>
  117. </div>
  118. <table class="params">
  119. <tbody>
  120. <tr>
  121. <td class="name">
  122. <strong>data</strong>
  123. </td>
  124. <td class="description last">
  125. <p>A JSON object representing the serialized geometry.</p>
  126. </td>
  127. </tr>
  128. </tbody>
  129. </table>
  130. <dl class="details">
  131. <dt class="tag-returns"><strong>Returns:</strong> A new instance.</dt>
  132. </dl>
  133. </div>
  134. <h2 class="subsection-title">Source</h2>
  135. <p>
  136. <a href="https://github.com/mrdoob/three.js/blob/master/src/geometries/SphereGeometry.js" translate="no" target="_blank" rel="noopener">src/geometries/SphereGeometry.js</a>
  137. </p>
  138. </article>
  139. </section>
  140. <script src="../scripts/linenumber.js"></script>
  141. <script src="../scripts/page.js"></script>
  142. </body>
  143. </html>
粤ICP备19079148号