4 ms·
The linked article says: > The arc length of quadratic Bézier curves actually can be computed with a closed form expression. While indeed true, the article do
by nvpr 2y ago
The linked article says:
> The arc length of quadratic Bézier curves actually can be computed with a closed form expression.
While indeed true, the article doesn't provide the closed form expression. The curious or unsatisfied reader can find the solution for the 2D case at the top of page 7 of this SIGGRAPH paper:
https://developer.download.nvidia.com/devzone/devcenter/gamegraphics/files/opengl/gpupathrender.pdf https://developer.download.nvidia.com/devzone/devcenter/game...
The quadratic function Q(t)=(x,y) is of the monomial form At^2 + Bt + C where A, B, and C are 2D coefficients (see page 5) where A is non-zero.
Simply convert your Bezier quadratic form to monomial form to apply this equation.
This equation still doesn't provide an arc length parameterization, the article's actual focus.
But if you did, say, want to move 26% (or N%, more generally) of the arc length along a quadratic Bezier segment, first compute the total (100%) arc length with the paper's formula (take care doing so as the paper suggests). Then split the Bezier at a halfway guess (try t=0.5). Again use the formula to evaluate the split quadratic. Repeating this in a divide and conquer fashion, you narrow in on the t value very close to 26% (or N%) of the arc length.
2D vector graphics standards expect to dash cubic & quadratic Bezier segments so some practical strategy to provide an arc length parameterization -- even if unavailable in closed form.
- NinjaKoala 2y agoYes, the procedure you mention works, but it's a numerical method. I'm not saying such numerical method's are impractical or something, but depending on your general setup, closed form formulas might be faster.
- phkahler 2y agoYou could also split the curve at an arbitrary value of the parameter t. Then find the length of that entire curve. Splitting at a specific value is straight forward. Edit: or were they talking about 26 percent of the length as opposed to t = 0.26? that's a different story. Edit2: Oh, that's just 0.26 times the total length. What am I missing?
- deleted 2y ago[deleted]