Smoothing a hand-drawn free shape

眉间皱痕 提交于 2019-12-05 03:44:20

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!