PeachDrawing.Core

PeachDrawing.Core.Geometry

PolygonClipper Class

Clips polygons made of straight edges against convex windows.

public static class PolygonClipper

Inheritance System.Object → PolygonClipper

Methods  
ClipToRect(IReadOnlyList<PaintPoint>, Rect) Clips a closed polygon to an axis-aligned rectangle, one edge of the rectangle at a time. The polygon may be convex, concave or self-intersecting: what makes each edge’s pass exact is that the <em>window</em> is convex, because clipping against a convex window can only shorten an original edge or add a piece of the window’s own boundary. So each contour of a multi-contour outline can be clipped on its own and the results filled together under the same fill rule, without a general polygon-against-polygon boolean.