# Go: Path simplification library

A few weeks ago, I got myself a Bamboo Slate tablet, and had a lot of fun playing around with the output. The Linux software for talking to that device is Tuhi, which is GUI driven, but also dumps the raw point and pressure data in JSON format into a directory.

As a side effect of playing around with that, I published a 2d path simplification library which uses the Ramer-Douglas-Peucker algorithm.

Given a sequence of 2D points, the algorithm determines a subset of these points so that the path drawn by these is still reasonably close to the original. Here is an example output:

I found the Ramer-Douglas-Peucker algorithm to be very clever, my attempts to come up with my own algorithm had really bad results in comparison.

The library is here:

I have a vague idea to use this for simplifying diagram drawings and straightening out imprecisely drawn shapes, replacing squiggly boxes and arrows with properly aligned ones. I’m not sure I’m going in the right direction with this approach, given that I’m not making use of pressure data and my knowledge of the shapes I want to recognize; we’ll see whether it’ll turn out to work.