A 2D polygon drawing panel.
Each polygon can be a convex one or a concave one, placed in a certain layer.
Each polygon has its line color and fill color.
Users can draw, erase, scale, rotate, fill, drag, mirror any polygon.
And two polygon can be clipped to get a new polygon.
Each polygon can contains a close ring like "回".
In the code, each simple polygon is stored in #PolygonCycle#, and complex polygons with inner-rings is stored in #ComplexPolygon#.
Drag a polygon to a new position
Clip two polygons, and get a new polygon which is the intersection of them.
The clipping is based on the Weiler-Atherton algorithm.
And a detail issue in the inner-ring case is fixed with W-A algorithm.
Filling is implemented using Scanline Fill Algorithm
Using matrix operations.
Using matrix operations.
Left-click to pick a vertex, and right-click to close a polygon cycle (that is a simple polygon).
And one or more polygon cycles form a complex polygon (with inner-rings).
Double right-click to finish a complex polygon.
And the complex polygon lies on a new layer.
Left-click to mirror a polygon horizontally, and right-click vertically.
Erase a polygon.