Calculate the length of a segment of a quadratic bezier

beziermath

I use this algorithm to calculate the length of a quadratic bezier:
http://www.malczak.linuxpl.com/blog/quadratic-bezier-curve-length/

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?

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)

Best Answer

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:

L(t)

Which we can write as

L(t)

Where b = B/(2A) and c = C/A.

Then transforming u = t + b we get

L(t)

Where k = c - b^2

Now we can use the integral identity from the link to obtain:

L(t)

So, in summary, the required steps are:

  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.
Related Topic