J. O'Rourke's "Triangulate" in Javascript

Directions: Draw a polygon by clicking the canvas below to add vertecies in a clockwise order. If the vertecies are not in clockwise order or the polygon self-intersects then the algorithm doesn't know what is "inside" the polygon and will give a nonsense triangulation or an error. Click Triangulate to triangulate your polygon and clear to start over. To see some examples click Chvátal's Comb or Godfried's Favorite Polygon.

Output:

Pointer Coordinates:

An implementation by Nicholas Wellcome - Source

Creative Commons License

Why Another Demo?

There are many computational geometry demos out on the web but too many are compiled Java applets where the source code is unavailable. This uses only technologies available within the browser; Javascript and the HTML5 canvas tag so by definition comes with the source code.

Tested in: