PitchKit
API Reference@pitchkit/coreFunctions

computePolygonCentroid()

function computePolygonCentroid(points): Point;

Defined in: packages/core/src/geometry/polygon.ts:9

Mean of the vertices. Used as the anchor point for a <Polygon> tooltip (there's no single "position" for an arbitrary shape the way a scatter point has one) — not a true area centroid, which would need per-edge shoelace weighting for a non-convex or unevenly-vertexed shape.

Parameters

ParameterType
pointsreadonly Point[]

Returns

Point

On this page