“追踪”算法 将连续点转换为贝塞尔曲线
我在 X,Y 中有一个连续的点集合,我想将它们“追踪”到一组贝塞尔曲线中。 是否可以使用任何开源位图到矢量跟踪算法或库来实现此目的?
I have a sequential collection of points in X,Y and I'd like to "trace" these into a set of bezier curves. Could any open source bitmap to vector tracing algorithm or library be used for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这取决于您想要实现的目标。 如果您想查看“最佳拟合”曲线,或者至少是粗略的近似值,则应该使用 b_spline。 b_spline 将使其自身适合给定的点“内部”。 为了遍历有问题的点,我通常会使用 Catmull-Rom 样条线,当给定点 1、2、3 时,该样条线将穿过点 2,其斜率等于点 1 和点 1 之间的斜率。 3.
示例代码:
http://willperone.net/Code/spline.php
算法说明:
http://steve.hollasch.net/cgindex/curves/catmull-rom。 html
This depends on what you want to accomplish. If you want to see the 'best fit' curve, or at least a rough approximation, you should use a b_spline. A b_spline will fit itself 'inside' the points it is given. For going through the points in question I would generally use a Catmull-Rom spline which, when given points 1,2,3 will pass through point 2 with slope equal to the slope between points 1 & 3.
Sample Code:
http://willperone.net/Code/spline.php
Explanation of the algorithm:
http://steve.hollasch.net/cgindex/curves/catmull-rom.html
如果您希望曲线穿过现有的一组点,则需要使用分段 B 样条曲线而不是贝塞尔曲线。
网络上有大量用于执行此操作的代码。
You want to use piece-wise b-spline curves rather than beziers if you want the curve to pass through an existing set of points.
There's tons of code on the web for doing this.