PitchKit
API Reference@pitchkit/coreFunctions

clipPolygonByHalfPlane()

function clipPolygonByHalfPlane(
   polygon, 
   boundaryPoint, 
   inwardNormal
): Point[];

Defined in: packages/core/src/geometry/voronoi.ts:28

Sutherland–Hodgman clip of a convex polygon against one half-plane: the boundary line passes through boundaryPoint perpendicular to inwardNormal, and points on the inwardNormal side are kept. Exported directly (not just as a voronoi.ts internal) since it's the reusable primitive computeVoronoiCells repeatedly applies per site pair, and it's independently testable without a full multi-site setup.

Parameters

ParameterType
polygonreadonly Point[]
boundaryPointPoint
inwardNormalPoint

Returns

Point[]

On this page