Kink detection in drawn polylines

Posted by David Rutten on Stack Overflow See other posts from Stack Overflow or by David Rutten
Published on 2010-04-27T20:43:52Z Indexed on 2010/04/27 20:53 UTC
Read the original article Hit count: 465

Filed under:
|
|

Users can sketch in my app using a very simple tool (move mouse while holding LMB). This results in a series of mousemove events and I record the cursor location at each event. The resulting polyline curve tends to be rather dense, with recorded points almost every other pixel. I'd like to smooth this pixelated polyline, but I don't want to smooth intended kinks. So how do I figure out where the kinks are?

The image shows the recorded trail (red pixels) and the 'implied' shape as a human would understand it. People tend to slow down near corners, so there is usually even more noise here than on the straight bits.

Polyline tracker

© Stack Overflow or respective owner

Related posts about trace

Related posts about mouse