# Bezier unit tangent

What is the explicit formula for a unit tangent vector to a Bezier curve? I.e. if the formula for a Bezier curve is $\mathbf{B}(t) = \sum_{i=0}^n\binom{n}i(1-t)^{n-i}t^i\mathbf{P}_i$, what is its unit tangent?

-

This page tells you how to calculate the derivative vector at a given parameter value on a Bezier curve.

http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/Bezier/bezier-der.html

Then, to get the unit tangent, you simply unitize the first derivative vector. So, the "explicit formula" for the unit tangent $\mathbf{U}$ is the same as for any parametric curve $\mathbf{C}$: $$\mathbf{U}(t) = \frac{\mathbf{C'}(t)}{\Vert \mathbf{C'}(t) \Vert}$$

Of course, there will be trouble if the first derivative vector is zero, but that's not likely to happen very often in practice. If it does, look up L'Hospitale's rule.

Derivatives at end-points (where $t=0$ or $t=1$) are especially simple, so one common approach is to subdivide the curve at the parameter value of interest, so that this becomes an end-point, and then use these simpler formulae.

The standard de Casteljau algorithm for computing a point on a Bezier curve actually does this subdivision, so it's easy to calculate the first derivative at the same time you're calculating a point.

Edit: The norm expression in the denominator involves a square root, of course, and this messes up any attempt at getting a nice tidy explicit formula (unless you think square roots are tidy). But, there's a class of Bezier curves called "pythagorean hodograph" (PH) curves. These are constrained so that $\Vert \mathbf{C'}(t) \Vert$ is a perfect square, and the formula then gets a lot nicer. A fellow named Rida Farouki wrote an entire book about these curves.

-