SphereGeometry.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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"><code>radius</code></td>
  37. <td class="description last"><p>The sphere radius.<br/>Default is <code>1</code>.</p></td>
  38. </tr>
  39. <tr>
  40. <td class="name"><code>widthSegments</code></td>
  41. <td class="description last"><p>The number of horizontal segments. Minimum value is <code>3</code>.<br/>Default is <code>32</code>.</p></td>
  42. </tr>
  43. <tr>
  44. <td class="name"><code>heightSegments</code></td>
  45. <td class="description last"><p>The number of vertical segments. Minimum value is <code>2</code>.<br/>Default is <code>16</code>.</p></td>
  46. </tr>
  47. <tr>
  48. <td class="name"><code>phiStart</code></td>
  49. <td class="description last"><p>The horizontal starting angle in radians.<br/>Default is <code>0</code>.</p></td>
  50. </tr>
  51. <tr>
  52. <td class="name"><code>phiLength</code></td>
  53. <td class="description last"><p>The horizontal sweep angle size.<br/>Default is <code>Math.PI*2</code>.</p></td>
  54. </tr>
  55. <tr>
  56. <td class="name"><code>thetaStart</code></td>
  57. <td class="description last"><p>The vertical starting angle in radians.<br/>Default is <code>0</code>.</p></td>
  58. </tr>
  59. <tr>
  60. <td class="name"><code>thetaLength</code></td>
  61. <td class="description last"><p>The vertical sweep angle size.<br/>Default is <code>Math.PI</code>.</p></td>
  62. </tr>
  63. </tbody>
  64. </table>
  65. </div>
  66. </div>
  67. <h2 class="subsection-title">Properties</h2>
  68. <div class="member">
  69. <h3 class="name" id="parameters" translate="no">.<a href="#parameters">parameters</a><span class="type-signature"> : Object</span> </h3>
  70. <div class="description">
  71. <p>Holds the constructor parameters that have been
  72. used to generate the geometry. Any modification
  73. after instantiation does not change the geometry.</p>
  74. </div>
  75. </div>
  76. <h2 class="subsection-title">Static Methods</h2>
  77. <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>
  78. <div class="method">
  79. <div class="description">
  80. <p>Factory method for creating an instance of this class from the given
  81. JSON object.</p>
  82. </div>
  83. <table class="params">
  84. <tbody>
  85. <tr>
  86. <td class="name"><code>data</code></td>
  87. <td class="description last"><p>A JSON object representing the serialized geometry.</p></td>
  88. </tr>
  89. </tbody>
  90. </table>
  91. <dl class="details">
  92. <dt class="tag-returns"><strong>Returns:</strong> A new instance.</dt>
  93. </dl>
  94. </div>
  95. <h2 class="subsection-title">Source</h2>
  96. <p>
  97. <a href="https://github.com/mrdoob/three.js/blob/master/src/geometries/SphereGeometry.js" target="_blank" rel="noopener" translate="no">src/geometries/SphereGeometry.js</a>
  98. </p>
  99. </article>
  100. </section>
  101. <script src="../scripts/linenumber.js"></script>
  102. <script src="../scripts/page.js"></script>
  103. </body>
  104. </html>
粤ICP备19079148号