I’ve been working on a graphics project that involves letting people make freehand drawings and then turning those drawings into various shapes. In order to test the core algorithm and explain it to my students, I implemented a very simple stand-along version of it.
The goal was to make the simplest possible version of the algorithm, so that the whole thing consists of only a few hundred lines of Javascript code. That way the students can easily look through the code to understand the algorithm without wading through thousands of lines of code within some larger software program.
The algorithm doesn’t care what set of drawings it recognizes, but this evening, for simplicity, I decided to make a little test case that consists of only the capital English letters.
One cool thing is that it recognizes your letter whether you draw it forward, backward, upside down or mirror flipped, and it will morph even a crude drawing into a nice looking letter.
You can try it for yourself here.