CapsuleGeometry.html 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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; [page:LatheGeometry] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">
  13. [name] is a geometry class for a capsule with given radii and height. It
  14. is constructed using a lathe.
  15. </p>
  16. <iframe
  17. id="scene"
  18. src="scenes/geometry-browser.html#CapsuleGeometry"
  19. ></iframe>
  20. <script>
  21. // iOS iframe auto-resize workaround
  22. if ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) {
  23. const scene = document.getElementById( 'scene' );
  24. scene.style.width = getComputedStyle( scene ).width;
  25. scene.style.height = getComputedStyle( scene ).height;
  26. scene.setAttribute( 'scrolling', 'no' );
  27. }
  28. </script>
  29. <h2>Code Example</h2>
  30. <code>
  31. const geometry = new THREE.CapsuleGeometry( 1, 1, 4, 8 );
  32. const material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
  33. const capsule = new THREE.Mesh( geometry, material ); scene.add( capsule );
  34. </code>
  35. <h2>Constructor</h2>
  36. <h3>
  37. [name]([param:Float radius], [param:Float length], [param:Integer capSegments], [param:Integer radialSegments])
  38. </h3>
  39. <p>
  40. radius — Radius of the capsule. Optional; defaults to `1`.<br />
  41. length — Length of the middle section. Optional; defaults to `1`.<br />
  42. capSegments — Number of curve segments used to build the caps. Optional;
  43. defaults to `4`.<br />
  44. radialSegments — Number of segmented faces around the circumference of the
  45. capsule. Optional; defaults to `8`.<br />
  46. </p>
  47. <h2>Properties</h2>
  48. <p>See the base [page:BufferGeometry] class for common properties.</p>
  49. <h3>[property:Object parameters]</h3>
  50. <p>
  51. An object with a property for each of the constructor parameters. Any
  52. modification after instantiation does not change the geometry.
  53. </p>
  54. <h2>Methods</h2>
  55. <p>See the base [page:BufferGeometry] class for common methods.</p>
  56. <h2>Source</h2>
  57. <p>
  58. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  59. </p>
  60. </body>
  61. </html>