Length of 2d parametric curve

124 Views Asked by At

I have seen a few other questions/answers with the same title, but with different equations.

I’d like to find a general solution to $\int\sqrt{(\frac{dx}{dt})^2+(\frac{dy}{dt})^2}dt$

Specifically, I’d like to find the length of a 2D cubic Bézier segment expressed parametrically as $x=At^3+Bt^2+Ct+D$ and $y=Et^3+Ft^2+Gt+H$

Clearly,$\frac{dx}{dt} = 3At^2+2Bt+C$ and $\frac{dy}{dt} = 3Et^2+2Ft+G$ so for a Bézier segment, the integral would be $\int\sqrt{(3At^2+2Bt+C)^2+(3Et^2+2Ft+G)^2}dt$

That expands to the rather cumbersome $\int(\sqrt{9(A^{2}+E^2)t^4+12(AB+EF)ABt^3+(6(AC+EG)+4B^2+4F^2)t^2+4(BC+FG)t+C^2+G^2})dt$

Using the following substitutions:
$\alpha=9(A^{2}+E^2)$
$\beta=12(AB+EF)AB$
$\gamma=6(AC+EG)+4B^2+4F^2$
$\delta=4(BC+FG)$
$k=C^2+G^2$
the expression can be written as
$\int(\sqrt{\alpha t^4+\beta t^3+\gamma t^2+\delta t+k}) dt$
And that’s where I hit a brick wall. I have no idea how to proceed from here. I’ve been told that it will take an infinite series to express the solution, but I suspect that fewer than a dozen terms will be sufficient for computational accuracy.
Any advice is welcome.

1

There are 1 best solutions below

0
On BEST ANSWER

Just use a numerical integration procedure, like Gaussian quadrature. As usual, you can find easy-to-use (but often not-quite-optimal) code in the Numerical Recipes book.

There are Bézier curves for which you can compute the arclength exactly. They are called Pythagorean Hodograph (PH) curves, and have been studied extensively by Rida Farouki and others. But, in return for easy arclength calculation, you sacrifice a lot of shape flexibility.

There is no closed-form formula for the arclength of a general Bézier curve whose degree is greater than 2.