ShapeUtils

A class containing utility functions for shapes.

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

Methods

.area(contour : Array) → Float

contour — 2D polygon. An array of 2D vectors.

Calculate area of a (2D) contour polygon.

.isClockWise(pts : Array) → Boolean

pts — points defining a 2D polygon.

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

Used internally by Path, ExtrudeGeometry and ShapeGeometry.

.triangulateShape(contour : Array, holes : Array) → Array

contour — 2D polygon. An array of Vector2.
holes — An array that holds arrays of Vector2s. Each array represents a single hole definition.

Used internally by ExtrudeGeometry and ShapeGeometry to calculate faces in shapes with holes.

Source

For more info on how to obtain the source code of this module see this page.