计算二次贝塞尔曲线段的长度 [英] Calculate the length of a segment of a quadratic bezier
问题描述
我使用此算法来计算二次贝塞尔曲线的长度: http://www.malczak.linuxpl.com/blog/quadratic- bezier-curve-length/
I use this algorithm to calculate the length of a quadratic bezier: http://www.malczak.linuxpl.com/blog/quadratic-bezier-curve-length/
但是,我想做的是计算从0到t的贝塞尔曲线的长度,其中0≤t. t < 1
However, what I wish to do is calculate the length of the bezier from 0 to t where 0 < t < 1
是否可以修改上面链接中使用的公式以获取贝塞尔曲线第一段的长度?
Is there any way to modify the formula used in the link above to get the length of the first segment of a bezier curve?
为了澄清,我不是在寻找q(0)和q(t)之间的距离,而是寻找这些点之间的弧长.
Just to clarify, I'm not looking for the distance between q(0) and q(t) but the length of the arc that goes between these points.
(我不希望使用自适应细分来接近长度)
(I don't wish to use adaptive subdivision to aproximate the length)
推荐答案
由于我确定该变量t
的情况下将存在类似的表单解决方案-我扩展了链接中给出的解决方案.
Since I was sure a similar form solution would exist for that variable t
case - I extended the solution given in the link.
从链接中的方程式开始:
Starting from the equation in the link:
我们可以写成
b = B/(2A)
和c = C/A
的地方.
然后转换u = t + b
我们得到
k = c - b^2
现在,我们可以使用链接中的积分标识来获取:
Now we can use the integral identity from the link to obtain:
因此,总的来说,所需的步骤是:
So, in summary, the required steps are:
- 按照原始方程式计算A,B,C.
- 计算
b = B/(2A)
和c = C/A
- 计算
u = t + b
和k = c -b^2
- 将这些值插入上面的公式中.
- Calculate A,B,C as in the original equation.
- Calculate
b = B/(2A)
andc = C/A
- Calculate
u = t + b
andk = c -b^2
- Plug these values into the equation above.
这篇关于计算二次贝塞尔曲线段的长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!