问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/6363568/smoothing-a-hand-drawn-free-shape