Arclength
The Pythagorean theorem allowed us to calculate the length of straight line segments. In this post, we'll see how to extend this to calculate the length of curved paths.
Let's consider this curved path:
We can sample points along this curve and connect them by line segments:
SourceThe result is a "piecewise linear" curve, shown in red. Since each piece of this is a line segment, we can calculate its length by applying the Pythagorean theorem to each segment and summing the results.
As we increase the density of the sample points, the piecewise linear curve becomes a better and better approximation of the original curve, and is length becomes a better and better approximation of the length of the original curve.
We can do the same thing in three dimensions:
SourceThere are several delicate questions raised by this procedure.
-
Are we calculating the "true" answer, or just approximations to it?
-
If we sample points differently, will we get a different answer?
-
If we use a different parametrization of the same curve, does the answer change?
The first point gets at the heart of what "real numbers" actually are. Think about how we use numbers in practice: we might only care about the value within If the values produced by the algorithm are guaranteed to stay within that error tolerance once the number of steps is big enough, we can use any of the values beyond that point as our answer.
A thorough answer to these questions involves limits, which we'll discuss in Chapter 5.
Arclength parametrization
Recall that a curve in is the image of some map
A choice of such an is called a parametrization of the curve For example, we can pre-compose with an easing function to get many other parametrizations.
A curve has lots and lots of different parametrizations; which one is best depends on the situation at hand and the nature of the curve. However, every curve has a canonical parametrization, called the arclength parametrization, and this is usually the best option. The definition is as follows:
Later, we will learn to find the arclength parametrization of more complicated curves; however, it is usually not possible to find an exact formula. It is doable by computer, however. As the above example shows, even in cases when we can find an exact formula for the arclength parametrization, it is often ugly (when written out in full).
APIs
Exercises
- In Parameters and coordinates, we found a parametrization of the unit circle given by
Using this parametrization, write code to calculate (approximate) the arclength of the unit circle.