Skip to content

1681-engine / index / polygonCentroid

Function: polygonCentroid() ​

ts
function polygonCentroid(points): Vec2;

Defined in: src/physics/polygon.ts:18

The centroid of the convex hull of points: where to put the body so a polygonShape(points) lands on them.

Parameters ​

ParameterType
pointsreadonly Vec2[]

Returns ​

Vec2

Released under the MIT License.