Skip to content

Repository files navigation

CGUI — Computational Geometry Playground

Interactive WPF app for visualizing computational geometry algorithms: draw points, lines, and polygons on a canvas, pick an algorithm, and see the result.

Overview

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.

Implemented algorithms

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.

Tech stack

  • 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 structure

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

Getting started

Requires Windows with Visual Studio (2013 or later) and the .NET Framework 4.8 developer pack.

  1. Clone the repo and open CGPackage.sln in Visual Studio.
  2. Set CGUI as the startup project.
  3. Build and run (F5).

To run the tests, use Visual Studio's Test Explorer.

Usage

  1. Launch CGUI.
  2. Draw input on the canvas — points for convex hull, line segments for sweep line, a closed polygon for triangulation.
  3. Select an algorithm from the list and run it; the output is drawn on the canvas.

License

MIT — see LICENSE.

About

Interactive WPF playground for computational geometry: draw points, lines, and polygons, then visualize convex hull, polygon triangulation, and segment intersection algorithms (C#, .NET Framework 4.8).

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages