Efficient Line Smoothing and/or Simplification

justin picture justin · Apr 29, 2011 · Viewed 16.2k times · Source

I am creating a painting application in Actionscript (although my question is not Actionscript related). The basic idea is to start painting when the mouse is pressed and tracking the mouse movements. What I want to achieve is:

  1. reduce mouse "noise" and
  2. create more smoother looking lines.

Right now, (1) is problematic because I get thousands of mouse movements within a few seconds. Due to (1) the line can look jaggy. What current idea: when the user finishes drawing the line, I store all movements in an array and reduce them (median threshold) and then use a spline algorithm to recreate a line.

Any better approaches?

Answer

lhf picture lhf · Apr 29, 2011

See Efficient Curve Fitting by Sarah Frisken. Also available at the author's page.