Skip to content
2D computational geometry algorithms in Haskell.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Cghs
viewer
.gitignore
LICENSE
README.md
Setup.hs
cghs.cabal
run.sh
stack.yaml

README.md

cghs

An haskell way to do 2D computational geometry.

The library provides the following geometric types:

  • points
  • vectors
  • segments
  • lines
  • triangles
  • polygons
  • circles
  • rays
  • regions of the plane

The following algorithms:

  • convex hull
  • triangulation of a convex polygon
  • simple triangulation of a point set

It also contains a viewer written using GLFW-b and OpenGL bindings.It alllows users to easily manipulate geometric objects and apply algorithms.

The following functionalities are supported by the viewer (AZERTY keyboard):

  • left-click for adding points
  • right-click for selecting points
  • 'r' to restore the initial state
  • 'c' to apply the convex hull algorithm on the selected points
  • 't' to triangulate the selected polygon or point set depending on the current mode
  • 'T' to compute the Delaunay triangulation of the selected point set
  • 'v' to compute the Voronoi diagram of a point set
  • 'p' to create a polygon where the vertices are the selected points
  • 'a' to toggle the selected component of the points
  • 's' to create a segment between two points
  • 'l' to create a line between two points
  • 'm' to get the next mode of selection
  • 'M' to get the previous mode of selection

TODO

  • Voronoi diagram: voronoiDiagram2
  • Delaunay triangulation: delaunayTriangulation2
  • Sweep-line algorithms: convex hull and point set triangulation
  • do a better thing for getRenderable stuff

Useful links

You can’t perform that action at this time.