0

There is a closed form solution to the arc length of a quadratic Bézier curve, namely: Assuming the Bézier is of the equation A + Bt + Ct^2 where A,B,C are vectors a = (B dot B), b = 2*(B dot C), and c = 4*(C dot C)

(2 * c * t + b) * sqrt(a + b * t + c * t ^ 2) / (4 * c) + log(2 * sqrt(c) * sqrt(a + b * t + c * t ^ 2) + 2 * c * t + b) * (4 * a * c - b ^ 2) / (8 * c ^ (3 / 2))

It's hairy, but does provide a precise answer as to the arc length of a given quadratic Bézier. I'm currently working with Bézier curves and need a way to create a function that, given a distance on the Bézier curve, returns a precise t value that can be used to place that point properly.

I'm aware that there are ways to approximate the arc parameterization of a Bézier curve, as for cubics and higher there is no closed form solution to the elliptic integral that returns their arc length, but since there is an exact equation that gives the length of a quadratic Bézier, would it be possible to find the inverse and get an equation that given a distance returns a t value? Putting that equation into Wolfram Alpha and asking it to solve for t has given me no luck.

  • There is a closed form for quadratic, because the arc length is only a fourth degree polynomial, which has a (stupidly cumbersome) symbolic solution. Cubic or higher, no closed form. Thanks, Abel and Ruffini. However, note that your question was "is there a" to which the answer is "yes, there is". If you actually want to know what that form is: you want https://math.stackexchange.com, not Stackoverflow. – Mike 'Pomax' Kamermans Aug 16 '22 at 22:56
  • Hi, the question isn't about whether there is a closed form equation to a quadratic, if you had read it you would have seen I wrote it in the first line. The question surrounds whether, using this closed form equation to arc length, are you able to precisely parameterize the Bézier curve over using a lookup table? I've made some progress in this problem by using newtons method to approximate a proper parameterization, but it has some really weird behavior towards the start of the curve. I was unsure whether there is a precise way to do what I am doing in the case of a quadratic curve. –  Luxistor Aug 16 '22 at 23:20
  • Remember: [your title summarizes your question](/help/how-to-ask). Make sure it does that. As for a LUT: there is a symbolic solution, implement that, then build your LUT. No need for Newton-Raphson. The solution is cumbersome, but you're in a programming language, so it doesn't care. Write it out (or make wolframalpha write it out for you), generate your LUT, then forget you ever implemented it. – Mike 'Pomax' Kamermans Aug 17 '22 at 00:00
  • You might be able to use https://github.com/Pomax/BezierInfo-2/issues/35 as jumping off point for a "simple" arc length reparameterization. – Mike 'Pomax' Kamermans Aug 17 '22 at 17:41

0 Answers0