ShapeUtils.html 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. <h1>[name]</h1>
  12. <div class="desc">
  13. A class containing utility functions for shapes.<br /><br />
  14. Note that these are all linear functions so it is neccessary to calculate separately for
  15. x, y (and z, w if present) components of a vector.
  16. </div>
  17. <h2>Methods</h2>
  18. <h3>[method:Number area]( contour )</h3>
  19. <div>
  20. contour -- 2D polygon.<br /><br />
  21. Calculate area of a ( 2D ) contour polygon.<br /><br />
  22. </div>
  23. <h3>[method:Boolean isClockwise]( pts )</h3>
  24. <div>
  25. pts -- points defining a 2D polygon<br /><br />
  26. Note that this is a linear function so it is neccessary to calculate separately for
  27. x, y components of a polygon.<br /><br />
  28. Used internally by [page:Path Path],
  29. [page:ExtrudeGeometry ExtrudeGeometry] and [page:ShapeBufferGeometry ShapeBufferGeometry].
  30. </div>
  31. <h3>[method:null triangulate]( contour, indices )</h3>
  32. <div>
  33. vertices -- flat array of vertices like [ x0,y0, x1,y1, x2,y2, ... ].<br />
  34. holeIndices -- array of hole indices.<br /><br />
  35. Performs a polygon triangulation based on earcut. The implementation is a port of [link:https://github.com/mapbox/earcut mapbox/earcut].
  36. </div>
  37. <h3>[method:null triangulateShape]( contour, holes )</h3>
  38. <div>
  39. contour -- 2D polygon.<br />
  40. holes -- array of holes<br /><br />
  41. Used by [page:ExtrudeGeometry ExtrudeGeometry] and [page:ShapeBufferGeometry ShapeBufferGeometry] to calculate faces in shapes with holes.
  42. </div>
  43. <h2>Source</h2>
  44. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  45. </body>
  46. </html>