Hermite Interpolation
Hermite Interpolation is a method of interpolating data points that accounts for not only the values of the function but also the values of its derivatives. While standard linear or polynomial interpolation only ensures the curve passes through the points (x_i, y_i). Hermite interpolation ensures the curve matches the "slope"(tangent) at those points as well. This results in a much smoother and more physically realistic transition between points, particularly in motion planning or structural deflection models where velocity or tangency must be continuous.
1. The Cubic Hermite Spline
The most common form is the Cubic Hermite Spline. For a single interval between x_0 and x_1 the interpolant is a third-degree polynomial.To construct it, we need four pieces of information: The starting and ending values: y_0 and y_1 The starting and ending derivatives (slopes): y'_0 and y'_1
The resulting curve is expressed using Hermite Basis Functions, which act as weights for the coordinates and the slopes.
Example 1C#

2. Implementation in SepalSolver
In SepalSolver, Hermite interpolation is often used when the user provides a "slope vector" alongside their dataset. This is common in trajectory generation where you know where a robot should be and how fast it should be moving at that specific moment.
Example 2C#
Smooth transition value: 5
Examples
.. Admonition:: Example 1 : Compare Linear and Hermite interpolation for sparsely compited sin(x)
If sin(x) is give at 7 points between 0 and \pi. Interpolate for sin(x) for 100 points between 0 and \pi using linear and hermite spline and compare the plots.
Example 3C#

.. Admonition:: Example 2 :
If a robot moves from point A to point B, a linear path causes an abrupt change in velocity at the corners. By using Hermite interpolation and specifying the desired entry/exit velocity vectors, we create a path that the robot can follow without stopping or jerking.
Example 4C#
Key Difference: Hermite vs. Cubic Spline
| Feature | Hermite Interpolation | Cubic Spline | |
|---|---|---|---|
| Input Requirements | Requires y and y' (slopes) | Requires only y | |
| Local Control | Changing one slope only affects the two adjacent segments | Changing one point can affect the entire curve | |
| Complexity | Mathematically simpler (local calculation) | Requires solving a system of equations (global) |
Exercise: Animation of Slope Impact
Task: Observe how changing the slope dy at the first point affects the plot of the function.
Example 5C#
</example 4>
.. Admonition:: Example 5 : Using Hermite Spline as Sin Approximator
Lets use table of Sine and Cosine at 15 degrees interval given in table
| Angle (°) | Sine (\sin) | Cosine (\cos) |
|---|---|---|
| 0° | 0 | 1 |
| 15° | \cfrac{\sqrt{6} - \sqrt{2}}{4} | \cfrac{\sqrt{6} + \sqrt{2}}{4} |
| 30° | \cfrac{1}{2} | \cfrac{\sqrt{3}}{2} |
| 45° | \cfrac{\sqrt{2}}{2} | \cfrac{\sqrt{2}}{2} |
| 60° | \cfrac{\sqrt{3}}{2} | \cfrac{1}{2} |
| 75° | \cfrac{\sqrt{6} + \sqrt{2}}{4} | \cfrac{\sqrt{6} - \sqrt{2}}{4} |
| 90° | 1 | 0 |
Example 6C#
Angle | Sineapprox | Sine ---------+--------------+------------- 22.47 | 0.382216 | 0.382220 49.22 | 0.757171 | 0.757178 34.61 | 0.568044 | 0.568049 39.39 | 0.634616 | 0.634623 76.86 | 0.973822 | 0.973824 81.41 | 0.988768 | 0.988780 80.35 | 0.985833 | 0.985843 19.16 | 0.328197 | 0.328200 12.59 | 0.217959 | 0.217960 38.53 | 0.622888 | 0.622895 42.79 | 0.679328 | 0.679330 20.26 | 0.346344 | 0.346347 22.28 | 0.379171 | 0.379176 25.29 | 0.427126 | 0.427129 47.94 | 0.742429 | 0.742432 64.80 | 0.904815 | 0.904823 23.18 | 0.393599 | 0.393604 31.18 | 0.517792 | 0.517793 17.09 | 0.293856 | 0.293857 43.92 | 0.693713 | 0.693713