[name]

A class containing utility functions for shapes.

Note that these are all linear functions so it is neccessary to calculate separately for x, y (and z, w if present) components of a vector.

Methods

[method:Number area]( contour )

contour -- 2D polygon.

Calculate area of a ( 2D ) contour polygon.

[method:Boolean isClockwise]( pts )

pts -- points defining a 2D polygon

Note that this is a linear function so it is neccessary to calculate separately for x, y components of a polygon.

Used internally by [page:Path Path], [page:ExtrudeGeometry ExtrudeGeometry] and [page:ShapeBufferGeometry ShapeBufferGeometry].

[method:null triangulate]( contour, indices )

vertices -- flat array of vertices like [ x0,y0, x1,y1, x2,y2, ... ].
holeIndices -- array of hole indices.

Performs a polygon triangulation based on earcut. The implementation is a port of [link:https://github.com/mapbox/earcut mapbox/earcut].

[method:null triangulateShape]( contour, holes )

contour -- 2D polygon.
holes -- array of holes

Used by [page:ExtrudeGeometry ExtrudeGeometry] and [page:ShapeBufferGeometry ShapeBufferGeometry] to calculate faces in shapes with holes.

Source

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]