Be warned, that code is GPLv3. I don't know the specific legal issues with using it or porting it to another language, but if you're going to use it you should check.
Judging from the demos, it feels like this code is treating each point with an equal weight, regardless of velocity. My mouse is configured to send 500 events per second, so the smoothing doesn't smooth all that much.
Depending on the latency limitations of the application in question, it seems like it would be better to use a curve simplifying algorithm similar to the one used by Inkscape, or maybe just dividing the curve into equally spaced points on the plane (instead of equally spaced points in time), taking care to preserve obvious changes in direction (perhaps by adding a point anywhere the locally smoothed first or second derivative crosses zero).
Just tested it with my mouse & graphics tablet. The unsmoothed version clearly works better for the stylus vs. mouse. What's interesting is the smoothed version ~equally improving both input methods.
That's an interesting manner of averaging. The end result is an exponential filter, but he displays the results online. It is fun to draw lines with high frequency components (wiggles) and watch them straighten out over half a second or so. It is aesthetically quite pleasing!
[+] [-] eduardordm|13 years ago|reply
Example: x = (p1.x + p2.x) * 0.5; y = (p1.y + p2.y) * 0.5;
Implementation (easily portable to html5):
https://github.com/eduardordm/wireframeapp/blob/master/wiref...
[+] [-] Skroob|13 years ago|reply
[+] [-] nitrogen|13 years ago|reply
Depending on the latency limitations of the application in question, it seems like it would be better to use a curve simplifying algorithm similar to the one used by Inkscape, or maybe just dividing the curve into equally spaced points on the plane (instead of equally spaced points in time), taking care to preserve obvious changes in direction (perhaps by adding a point anywhere the locally smoothed first or second derivative crosses zero).
[+] [-] blaze33|13 years ago|reply
Nice work !
[+] [-] threepointone|13 years ago|reply
still experimental, but I'm learning.
[+] [-] tlarkworthy|13 years ago|reply
[+] [-] kghose|13 years ago|reply
[+] [-] yeureka|13 years ago|reply
I don't know signal processing theory, but I derived the same formula years ago to filter high frequency changes in motion.
Now I know what to call it: an exponential moving average.