开发者

Smoothing a hand-drawn free shape

开发者 https://www.devze.com 2023-03-13 11:05 出处:网络
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开发者_JAVA百科 user moved his finger so the resulting shape is somewhat jagg

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开发者_JAVA百科 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消