PolyhedronGeometry.html 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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">
  13. A polyhedron is a solid in three dimensions with flat faces. This class
  14. will take an array of vertices, project them onto a sphere, and then
  15. divide them up to the desired level of detail. This class is used by
  16. [page:DodecahedronGeometry], [page:IcosahedronGeometry],
  17. [page:OctahedronGeometry], and [page:TetrahedronGeometry] to generate
  18. their respective geometries.
  19. </p>
  20. <h2>Code Example</h2>
  21. <code>
  22. const verticesOfCube = [
  23. -1,-1,-1, 1,-1,-1, 1, 1,-1, -1, 1,-1,
  24. -1,-1, 1, 1,-1, 1, 1, 1, 1, -1, 1, 1,
  25. ];
  26. const indicesOfFaces = [
  27. 2,1,0, 0,3,2,
  28. 0,4,7, 7,3,0,
  29. 0,1,5, 5,4,0,
  30. 1,2,6, 6,5,1,
  31. 2,3,7, 7,6,2,
  32. 4,5,6, 6,7,4
  33. ];
  34. const geometry = new THREE.PolyhedronGeometry( verticesOfCube, indicesOfFaces, 6, 2 );
  35. </code>
  36. <h2>Constructor</h2>
  37. <h3>
  38. [name]([param:Array vertices], [param:Array indices], [param:Float radius], [param:Integer detail])
  39. </h3>
  40. <p>
  41. vertices — [page:Array] of points of the form [1,1,1, -1,-1,-1, ... ]
  42. <br />
  43. indices — [page:Array] of indices that make up the faces of the form
  44. [0,1,2, 2,3,0, ... ] <br />
  45. radius — [page:Float] - The radius of the final shape <br />
  46. detail — [page:Integer] - How many levels to subdivide the geometry. The
  47. more detail, the smoother the shape.
  48. </p>
  49. <h2>Properties</h2>
  50. <p>See the base [page:BufferGeometry] class for common properties.</p>
  51. <h3>[property:Object parameters]</h3>
  52. <p>
  53. An object with a property for each of the constructor parameters. Any
  54. modification after instantiation does not change the geometry.
  55. </p>
  56. <h2>Methods</h2>
  57. <p>See the base [page:BufferGeometry] class for common methods.</p>
  58. <h2>Source</h2>
  59. <p>
  60. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  61. </p>
  62. </body>
  63. </html>