Smoothing a hand-drawn free shape

2019-04-02 02:36发布

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条回答
小情绪 Triste *
2楼-- · 2019-04-02 03:05

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.

查看更多
登录 后发表回答