SphereGeometry.html 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. [page:BufferGeometry] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">A class for generating sphere geometries.</p>
  13. <iframe
  14. id="scene"
  15. src="scenes/geometry-browser.html#SphereGeometry"
  16. ></iframe>
  17. <script>
  18. // iOS iframe auto-resize workaround
  19. if ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) {
  20. const scene = document.getElementById( 'scene' );
  21. scene.style.width = getComputedStyle( scene ).width;
  22. scene.style.height = getComputedStyle( scene ).height;
  23. scene.setAttribute( 'scrolling', 'no' );
  24. }
  25. </script>
  26. <h2>Code Example</h2>
  27. <code>
  28. const geometry = new THREE.SphereGeometry( 15, 32, 16 );
  29. const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
  30. const sphere = new THREE.Mesh( geometry, material ); scene.add( sphere );
  31. </code>
  32. <h2>Constructor</h2>
  33. <h3>
  34. [name]([param:Float radius], [param:Integer widthSegments], [param:Integer heightSegments], [param:Float phiStart], [param:Float phiLength],
  35. [param:Float thetaStart], [param:Float thetaLength])
  36. </h3>
  37. <p>
  38. radius — sphere radius. Default is `1`.<br />
  39. widthSegments — number of horizontal segments. Minimum value is `3`, and the
  40. default is `32`.<br />
  41. heightSegments — number of vertical segments. Minimum value is `2`, and the
  42. default is `16`.<br />
  43. phiStart — specify horizontal starting angle. Default is `0`.<br />
  44. phiLength — specify horizontal sweep angle size. Default is Math.PI *
  45. 2.<br />
  46. thetaStart — specify vertical starting angle. Default is `0`.<br />
  47. thetaLength — specify vertical sweep angle size. Default is Math.PI.<br />
  48. </p>
  49. <p>
  50. The geometry is created by sweeping and calculating vertexes around the Y
  51. axis (horizontal sweep) and the Z axis (vertical sweep). Thus, incomplete
  52. spheres (akin to `'sphere slices'`) can be created through the use of
  53. different values of phiStart, phiLength, thetaStart and thetaLength, in
  54. order to define the points in which we start (or end) calculating those
  55. vertices.
  56. </p>
  57. <h2>Properties</h2>
  58. <p>See the base [page:BufferGeometry] class for common properties.</p>
  59. <h3>[property:Object parameters]</h3>
  60. <p>
  61. An object with a property for each of the constructor parameters. Any
  62. modification after instantiation does not change the geometry.
  63. </p>
  64. <h2>Methods</h2>
  65. <p>See the base [page:BufferGeometry] class for common methods.</p>
  66. <h2>Source</h2>
  67. <p>
  68. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  69. </p>
  70. </body>
  71. </html>