计算二次贝塞尔曲线段的长度 [英] Calculate the length of a segment of a quadratic bezier

查看:195
本文介绍了计算二次贝塞尔曲线段的长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用此算法来计算二次贝塞尔曲线的长度: 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:

  1. 按照原始方程式计算A,B,C.
  2. 计算b = B/(2A)c = C/A
  3. 计算u = t + bk = c -b^2
  4. 将这些值插入上面的公式中.
  1. Calculate A,B,C as in the original equation.
  2. Calculate b = B/(2A) and c = C/A
  3. Calculate u = t + b and k = c -b^2
  4. Plug these values into the equation above.

这篇关于计算二次贝塞尔曲线段的长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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