Skip to main content

Function: calculateSignedArea()

calculateSignedArea(vertices): number

Defined in: physics/shapes/polygon-math.ts:11

Calculates the signed area of a polygon (twice the actual area). Positive for a polygon whose vertices are wound in this engine's canonical "outward-normal" order (see PolygonShape's constructor), negative for the reverse winding.

Parameters

vertices

readonly Vector2[]

The polygon's vertices, in order.

Returns

number

The signed area of the polygon.