Skip to content

Function: polygonArea()

polygonArea(points): number

Defined in: geom.ts:51

Signed area of the polygon a point sequence encloses (the shoelace formula), treating the path as closed. Positive when the points wind counter-clockwise in a y-up world — which, on a canvas (y-down), means clockwise. Callers who only care about size take Math.abs.

This is the "what did the user just circle?" primitive: run a stroke's points (raw, or densified through the spline for a fairer boundary) through it and you have the enclosed area in px².

Parameters

points

readonly Vec[]

Returns

number