polygon-editor is a desktop polygon editor with multi-os support. It allows you to create, edit and delete polygonal chains.
(Go 1.21)[https://go.dev/doc/install] (Fyne)[https://developer.fyne.io/] (Fyne dependencies)[https://developer.fyne.io/started/]
List of controls:
- LMB on segment: select segment and polygon
- LMB not on segment: create new circle
- RMB on circle: delete circle
- RMB on segment: add new circle in the middle of the segment
- LMB DRAG on circle: move circle
- LMB DRAG on segment: move segment
- LMB DRAG on polygon: move polygon
Legend:
- LMB: left mouse button
- RMB: right mouse button
- LMB DRAG: left mouse button press while moving mouse
List of featuers:
- create circle
- create polygon
- create new circle in the middle of the segment
- remove circle
- move circle
- move segment
- move polygon
- add horizontal constraint to segment
- add vertical constraint to segment
- remove contraint from segment
- create offset to polygon
- manage multiple polygons
Circles are drawn using midpoint circle algoritm.
Lines are drawn using:
- Bresenham'slinealgorithm
- Xiaolin Wu's line algorithm (anti-aliasing)
Offset algorithm calculates offset points by creating two normals. We add prev segment normal and next segment normal, to get offset polygon point. For concave angle 3 points are created (which next repair algorithm will fix if intersections was introduced). Then fix algorithm looks for intersections. Remove intersections loops (removing intersections) to create proper offset.
Author of this project is Jakub Rudnik.