平滑手绘自由形状 [英] Smoothing a hand-drawn free shape

查看:93
本文介绍了平滑手绘自由形状的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个允许用户进行手绘的应用程序。问题是我在用户移动手指的点之间绘制线条,因此产生的形状有些锯齿状。

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?

推荐答案

你可以使用某种曲线拟合(可能是 Bezier曲线)为你做。

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

还有这个非常好的示例它是如何工作的。我找不到它的源代码,但我认为这个的创建者使用了来自图形宝石1 。你可以找到它的c代码这里和我在SO上也发现了这个

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.

这篇关于平滑手绘自由形状的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆