Function: clipPolygonToConvex()
ts
function clipPolygonToConvex(subject, clip): Polygon[];Intersection of a simple polygon (convex or not) with a convex clip polygon, as separate pieces. Unlike clipConvex, a subject that the clip edge cuts into several parts comes back as several clean polygons.
The subject's outline is walked edge by edge; the stretches inside the clip region form chains that enter and leave through the clip outline. Each piece is a chain followed by a walk forward along the clip outline to wherever the next chain enters (both outlines have the same orientation, so "forward" stays on the inside).
Parameters
| Parameter | Type |
|---|---|
subject | Polygon |
clip | Polygon |
Returns
Polygon[]