高效的线路平滑和

高效的线路平滑和

本文介绍了高效的线路平滑和/或简化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Actionscript中创建一个绘画应用程序(尽管我的问题与Actionscript不相关).基本思想是在按下鼠标时开始绘画并跟踪鼠标的移动.我想要实现的是:

I am creating a painting application in Actionscript (although my question is not Actionscript related). The basic idea is to start painting when the mouse is pressed and tracking the mouse movements. What I want to achieve is:

  1. 减少鼠标的噪音"和
  2. 创建更平滑的线条.

现在,( 1 )是有问题的,因为我在几秒钟内获得了数千次鼠标移动.由于( 1 ),该行看起来很锯齿.当前的想法是:当用户完成绘制线条时,我将所有运动存储在一个数组中并减小它们(中值阈值),然后使用样条算法重新创建一条线.

Right now, (1) is problematic because I get thousands of mouse movements within a few seconds. Due to (1) the line can look jaggy.What current idea: when the user finishes drawing the line, I store all movements in an array and reduce them (median threshold) and then use a spline algorithm to recreate a line.

还有更好的方法吗?

推荐答案

请参见有效的曲线拟合莎拉·弗里斯肯(Sarah Frisken).也可以在作者页面上 .

See Efficient Curve Fitting by Sarah Frisken. Also available at the author's page.

这篇关于高效的线路平滑和/或简化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 13:23