将N点的贝塞尔曲线转换为许多立方贝塞尔曲线 [英] convert bezier curve with N point to many cubic bezier curve

查看:159
本文介绍了将N点的贝塞尔曲线转换为许多立方贝塞尔曲线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有大约48个ctrl点的贝塞尔曲线,我想将其转换为许多立方贝塞尔曲线... 任何算法,数学理论或只是一个链接都可能会有所帮助:) ??

I have bezier curve with about 48 ctrl points and I want to transform it to many cubic bezier curves... Any algorthim , math theory or just a link may help :) ??

推荐答案

数学理论:您不能这样做.由于曲率无法真实地表示,因此n阶Bezier曲线不能表示为任意数量的第(n-1)阶Bezier曲线.您可以近似估计,但不会得到完全相同的结果.

Math theory: you cannot do this. An nth order Bezier curve cannot be represented as any number of (n-1)th order Bezier curves, because the curvatures cannot be faithfully represented. You can approximate it, but you won't get an identical result.

实践:您可以将48阶曲线切成简单曲线的各个部分,其中所有控制点都位于起点/终点基线的同一侧,而曲线中点的控制变量大致位于曲线的凸包的中心.对于此类曲线,低电平曲线是合理的近似值.您可以通过使用48阶曲线的一阶,二阶等导数根找到曲线上的拐点来实现此目的(请参见 http://pomax.github.com/bezierinfo/#derivatives http ://pomax.github.com/bezierinfo/#splitting ),然后运行de Casteljau的算法在每个拐点的控制变量值之间分割曲线.然后,您可以使用三次曲线来近似每个所得的子曲线,并且结果将看起来与原始曲线非常接近(或在像素级别看起来相同).

Practice: you can cut up your 48th order curve into sections of simple curve, where all the control points are on the same side of the start/end baseline, and the midpoint on the curve w.r.t your control variable is roughly in the center of the convex hull for the curve. For such curves, low level curves are reasonable approximations. You can do this by finding the inflections on the curve using the first, second, etc. derivative roots for your 48th order curve (see http://pomax.github.com/bezierinfo/#derivatives and http://pomax.github.com/bezierinfo/#splitting) and then running de Casteljau's algorithm to split up the curve between each inflection point's control variable value. You can then approximate each of the resultant subcurves with cubic curves and the result will look pretty close (or look identical at the pixel level) to your original curve.

那是说:为什么你甚至还有48阶曲线,那是疯狂的= P

That said: why the hell do you even have a 48th order curve, that's insane =P

这篇关于将N点的贝塞尔曲线转换为许多立方贝塞尔曲线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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