Kevin Mehall

Line and Shape Recognition in Javascript


Here's a quick little Javascript + HTML5 canvas demo. Click and drag to draw lines. It recognizes sharp corners and transforms your path into straight lines.

If you end the line near the starting point, it will fill the polygon. If the shape resembles a rectangle, it will square the corners.

[It uses canvas, so don't expect it to work in IE]

Source code under the MIT license.