Shape.html 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <script src="../../../list.js"></script>
  6. <script src="../../../page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="../../../page.css" />
  8. </head>
  9. <body>
  10. [page:Path] &rarr;
  11. <h1>[name]</h1>
  12. <div class="desc">
  13. Defines an arbitrary 2d shape plane using paths with optional holes. It can be used with [page:ExtrudeGeometry],
  14. [page:ShapeGeometry], to get points, or to get triangulated faces.
  15. </div>
  16. <code>
  17. var heartShape = new THREE.Shape();
  18. heartShape.moveTo( 25, 25 );
  19. heartShape.bezierCurveTo( 25, 25, 20, 0, 0, 0 );
  20. heartShape.bezierCurveTo( 30, 0, 30, 35,30,35 );
  21. heartShape.bezierCurveTo( 30, 55, 10, 77, 25, 95 );
  22. heartShape.bezierCurveTo( 60, 77, 80, 55, 80, 35 );
  23. heartShape.bezierCurveTo( 80, 35, 80, 0, 50, 0 );
  24. heartShape.bezierCurveTo( 35, 0, 25, 25, 25, 25 );
  25. var extrudeSettings = { amount: 8, bevelEnabled: true, bevelSegments: 2, steps: 2, bevelSize: 1, bevelThickness: 1 };
  26. var geometry = new THREE.ExtrudeGeometry( shape, extrudeSettings );
  27. var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() );
  28. </code>
  29. <h2>Examples</h2>
  30. <div>
  31. [example:webgl_geometry_shapes geometry / shapes ]<br/>
  32. [example:webgl_geometry_extrude_shapes geometry / extrude / shapes ]<br/>
  33. [example:webgl_geometry_extrude_shapes2 geometry / extrude / shapes2 ]<br/>
  34. [example:webgl_particles_shapes particles / shapes ]
  35. </div>
  36. <h2>Constructor</h2>
  37. <h3>[name]()</h3>
  38. <h2>Properties</h2>
  39. <h3>[property:array holes]</h3>
  40. <div>
  41. An array of [page:Path paths] that define the holes in the shape.
  42. </div>
  43. <h2>Methods</h2>
  44. <h3>[method:ShapeGeometry makeGeometry]([page:Object options])</h3>
  45. <div>
  46. options -- This is passed as the second argument to [page:ShapeGeometry ShapeGeometry]
  47. </div>
  48. <div>
  49. Convenience method to return ShapeGeometry
  50. </div>
  51. <h3>[method:Array extractAllPoints]([page:Integer divisions])</h3>
  52. <div>
  53. divisions -- The number of divisions to create on the shape
  54. </div>
  55. <div>
  56. Get points of shape and holes (keypoints based on segments parameter)
  57. </div>
  58. <h3>[method:ExtrudeGeometry extrude]([page:Object options])</h3>
  59. <div>
  60. options -- This is passed as the second argument to [page:ExtrudeGeometry ExtrudeGeometry]
  61. </div>
  62. <div>
  63. Convenience method to return ExtrudeGeometry
  64. </div>
  65. <h3>[method:Object extractPoints]([page:Integer divisions])</h3>
  66. <div>
  67. divisions -- The number of divisions to create on the shape
  68. </div>
  69. <div>
  70. Returns an object with a *shape* and *holes* property that each reference an array of [page:Vector2 Vector2s].
  71. </div>
  72. <h3>[method:Object extractAllSpacedPoints]([page:Integer divisions])</h3>
  73. <div>
  74. divisions -- The number of divisions to create on the shape
  75. </div>
  76. <div>
  77. Returns an object with a *shape* and *holes* property that each reference an array of [page:Vector2 Vector2s]. The
  78. points will all be equally spaced along the shape.
  79. </div>
  80. <h3>[method:Array getPointsHoles]([page:Integer divisions])</h3>
  81. <div>
  82. divisions -- The number of divisions to create on the shape
  83. </div>
  84. <div>
  85. Get an array of [page Vector2 Vector2s] that represent the holes in the shape.
  86. </div>
  87. <h3>[method:Array getSpacedPointsHoles]([page:Integer divisions])</h3>
  88. <div>
  89. divisions -- The number of divisions to create on the shape
  90. </div>
  91. <div>
  92. Get an array of equally spaced [page Vector2 Vector2s] that represent the holes in the shape.
  93. </div>
  94. <h2>Source</h2>
  95. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  96. </body>
  97. </html>