C2 Cubic Piecewise Interpolation with Different Parameterization Methods

On the previous geometric modelling class assignment, we were given some points in dimension 2, and then asked to implement a C2 cubic interpolation with 3 different parameterization methods.

Here I will try to explain briefly everything related to the image above as much as I can in layman terms. 


Remember in junior high when mathematics was very basic, where we were given 2 points $(x_1, y_1); (x_2,y_2)$ and then we were asked to find a line passing these points? This is what interpolation means. Only that we would want a spline instead of a line, which means that it will involve polynomial equations. A line $f(x)=ax+b$ itself is a degree one polynomial.


Piecewise means that we want the interpolation to be done separately by considering only 2 points at one time. And then we connect those pieces into one complete spline.

C2 Continuity

Above we also see the terms C2 cubic interpolation. What C2 means is that we want the spline segments to be connected in the way such that their second derivative are the same. Here I call a spline between 2 points as a spline segment. 


For this term we may refer to Bézier curve where it indicates that the curve will have 4 control points. Here is the equation for Bézier representation:
$p(u)=\sum_{i=0}^n c_i B^n_i(u)$ where $B^n_i(x)=\binom{n}{i}t^n (1-x)^{n-i}$


The image above was drawn using 3 different parameterization methods:
  • uniform for $\mu=0$
  • chordal for $\mu=1$
  • centripetal for $\mu=0.5$
The $\mu$ was used to calculate the length of each parameter in their sequence $t_0,t_1, ..., t_n$ by using $t_{i+1}-t_i=\|x_{i+1}-x_i\|^\mu$

To make it easier to imagine how these $\mu$ values will affect the shape of the spline, I made up a little story by looking the points as the racing game where the driver were required to pass these points in order to complete the race. Here we have 3 different drivers with different driving style.

Racer #1 drives with the same speed all the way, this is why he made sharp turn when he has to pass points that are closed to each other. This causes the ^ section which is called as cusp.

And then moving on to racer #2 who adjusts his speed extremely based from time to time by observing how far away the next point is. If the next point is near then he will slow down, otherwise if it is still far away then he will increase speed. This causes the last turn to be a late apex.
In racing, a driver will often use a "late apex," turning into the corner a little later than normal in order to straighten out the last part of the corner. This allows the driver to accelerate earlier and harder, gaining maximum speed down the next straight.
Lastly racer #3 is also the type who adjusts speed based on how far away the next point is. But he does not make too much extreme changes of speed along the way. So here we can see that the driving path he made is the one passing those points elegantly.

The question now is which racers complete the trip the earliest?
They completed it in the same amount of time!

0 comments: (+add yours?)