How to find the arc length parametrization of a cubic bezier?

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)$

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))$.
• Using numerical integration, one would (for instance) approximate the integral by a finite sum, with a small mesh size. You can also numerically compute an approximation to $t(s)$, by taking for each $s$ in some mesh of points, the first $t$ value for which the integral is larger than your choice of $s$. This is easy to code by hand, or use any numerical integration package. – pre-kidney Apr 16 '17 at 23:46