Interactive WPF app for visualizing computational geometry algorithms: draw points, lines, and polygons on a canvas, pick an algorithm, and see the result.
This project pairs a set of classic computational geometry algorithm implementations with a desktop UI for experimenting with them. You sketch input shapes directly on a drawing canvas, select an algorithm from a list (populated automatically via reflection over the Algorithm base class), and run it to see the output points, lines, and polygons rendered back on the canvas.
The algorithms were implemented as part of a computational geometry course.
Convex hull
- Extreme Points
- Extreme Segments
- Incremental
- Jarvis March (gift wrapping)
- Graham Scan
- Quick Hull
Polygon triangulation
- Subtracting Ears (ear clipping)
Segment intersection
- Sweep Line
A few algorithm entries (Divide & Conquer hull, Inserting Diagonals, Monotone Partitioning, Monotone Triangulation) exist as stubs and are not yet implemented.
- C# on .NET Framework 4.8
- WPF for the UI
- MSTest for unit tests
- Custom geometry primitives and ordered data structures (red-black tree–backed sets/bags) in
CGUtilities
| Project | Purpose |
|---|---|
CGAlgorithms |
Algorithm implementations (convex hull, triangulation, segment intersection) |
CGUtilities |
Geometry primitives (Point, Line, Polygon), helper methods, data structures |
CGUI |
WPF front end with the drawing canvas |
CGAlgorithmsUnitTest / CGUtilitiesUnitTest |
MSTest test suites |
Requires Windows with Visual Studio (2013 or later) and the .NET Framework 4.8 developer pack.
- Clone the repo and open
CGPackage.slnin Visual Studio. - Set
CGUIas the startup project. - Build and run (F5).
To run the tests, use Visual Studio's Test Explorer.
- Launch
CGUI. - Draw input on the canvas — points for convex hull, line segments for sweep line, a closed polygon for triangulation.
- Select an algorithm from the list and run it; the output is drawn on the canvas.
MIT — see LICENSE.