[Math] How to find the arc length parametrization of a cubic bezier

arc lengthbezier-curvecubicscurvesgeometry

I have a cubic bezier curve, with the control points $P_0, P_1, P_2, P_3 \in\mathbf{R}^3 $

If I would like to walk from $P_0$ to $P_3$, then to calculate my current position I just linearly interpolate $t \in \mathbf{R}$ from $0 \to 1$ and call this function:

$$ \mathbf{B}(t)=(1-t)^3\mathbf{P}_0+3(1-t)^2t\mathbf{P}_1+3(1-t)t^2\mathbf{P}_2+t^3\mathbf{P}_3 $$

How should I transform $t$ to walk from $P_0$ to $P_3$ the same speed?

I mean if $ |t_x – t_y | = | t_a – t_b |$ then the arclength between $ \mathbf{B}(t_x) $ and $ \mathbf{B}(t_y) $ should equal to the length between $ \mathbf{B}(t_a) $ and $ \mathbf{B}(t_b) $

Best Answer

The velocity of the walker (in the first parametrization you have written) is $$ \mathbf{B}'(t)=-3(1-t)^2\mathbf{P}_0+3(3t^2-4t+1)\mathbf{P}_1+3t(2-3t)\mathbf{P}_2+3t^2\mathbf{P}_3. $$ From this, you can obtain the arclength as $$ s(t)=\int_0^t\|\mathbf{B}'(u)\|\ du. $$ In general the integrand is a messy expression depending very precisely on the control points, and there is most likely no elementary antiderivative for points in general position.

There is no simple expression for the arclength function. Perhaps a numerical integration suffices for the application you are interested in. Then one would proceed by finding the inverse function of $s(t)$, writing $t=t(s)$. Then the arclength parametrization is $\mathbf{B}(t(s))$.