2

I am creating an app that allows the user to do some hand-drawing. The problem is I draw lines between the points where the user moved his finger so the resulting shape is somewhat jagged.

My question is how can I smooth the drawing? What is the best algorithm for dealing with this kind of situation?

Raphael
  • 7,972
  • 14
  • 62
  • 83

1 Answers1

7

You could use some kind of curve fitting (maybe Bezier curve) to do it for you.

There is also this very nice example of how it could work. I could not find source code for it but i think that creator of this one has used algorithm from Graphics Gems 1. You could find c code for it here and i have found on SO also this.

Community
  • 1
  • 1
Archibald
  • 846
  • 10
  • 24