CapsuleGeometry.html 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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.
  14. It is constructed using a lathe.
  15. </p>
  16. <iframe id="scene" src="scenes/geometry-browser.html#CapsuleGeometry"></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>const geometry = new THREE.CapsuleGeometry( 1, 1, 4, 8 );
  28. const material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
  29. const capsule = new THREE.Mesh( geometry, material );
  30. scene.add( capsule );
  31. </code>
  32. <h2>Constructor</h2>
  33. <h3>[name]([param:Float radius], [param:Float length], [param:Integer capSubdivisions], [param:Integer radialSegments])</h3>
  34. <p>
  35. radius — Radius of the capsule. Optional; defaults to 1.<br />
  36. length — Length of the middle section. Optional; defaults to 1.<br />
  37. capSegments — Number of curve segments used to build the caps. Optional; defaults to 4.<br />
  38. radialSegments — Number of segmented faces around the circumference of the capsule. Optional; defaults to 8.<br />
  39. </p>
  40. <h2>Properties</h2>
  41. <p>See the base [page:BufferGeometry] class for common properties.</p>
  42. <h3>[property:Object parameters]</h3>
  43. <p>
  44. An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry.
  45. </p>
  46. <h2>Methods</h2>
  47. <p>See the base [page:BufferGeometry] class for common methods.</p>
  48. <h2>Source</h2>
  49. <p>
  50. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  51. </p>
  52. </body>
  53. </html>