Skip to content

spatial-monorepo


spatial-monorepo / wayfinding/src / lineStringMidpoint

Function: lineStringMidpoint()

lineStringMidpoint(coords): Position2D

Defined in: packages/wayfinding/src/graph.ts:38

True geometric midpoint of a LineString: the point at half the polyline's total length, interpolated along the segment that straddles it — not the arithmetic mean of its vertices (which would be biased toward denser clusters of points on multi-vertex lines). Falls back to the arithmetic mean for degenerate (zero-length) lines.

Parameters

coords

Position2D[]

Returns

Position2D

Released under commercial licensing.