Shape.html 3.6 KB

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