Skip to content

nyorem/cghs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

2D computational geometry algorithms in Haskell.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published