Skip to main content

Function: calculateNormals()

calculateNormals(vertices): Vector2[]

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

Calculates the outward-facing edge normal for each edge of a polygon (the edge from vertex i to vertex i + 1), assuming vertices are wound in this engine's canonical order (see calculateSignedArea).

Parameters

vertices

readonly Vector2[]

The polygon's vertices, in order.

Returns

Vector2[]

The polygon's edge normals, in the same order as vertices.