ShapeUtils.html.md 971 B

ShapeUtils

A class containing utility functions for shapes.

Static Methods

.area( contour : Array. ) : number

Calculate area of a ( 2D ) contour polygon.

contour

An array of 2D points.

Returns: The area.

.isClockWise( pts : Array. ) : boolean

Returns true if the given contour uses a clockwise winding order.

pts

An array of 2D points defining a polygon.

Returns: Whether the given contour uses a clockwise winding order or not.

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

Triangulates the given shape definition.

contour

An array of 2D points defining the contour.

holes

An array that holds arrays of 2D points defining the holes.

Returns: An array that holds for each face definition an array with three indices.

Source

src/extras/ShapeUtils.js

粤ICP备19079148号