#include <Interpolator.h>
Inheritance diagram for InterpolatorCubicSpline:
Public Member Functions | |
InterpolatorCubicSpline (unsigned int dim, unsigned int num_samples=3) | |
void | Eval (float t, T *value) |
void | ComputeTangents (unsigned int i) |
The cubic spline interpolator uses 2 points P_0, P_1 and their respective tangents/derivatives T_0, T_1 to build a third order interpolation polynomial which is usually very smooth, and much better than simple cubic interpolation without tangent information.
The derivatives can be passed by the user together with the samples, or computed by numerical differentiation byt the method ComputeTangents() using:
T_i = a*(P_i+1 - P_i-1)
Where a = 0.5 generates Catmull-Rom splines.
The first and last points' derivatives cannot be intialized this way, their value is set to 0.
|
Constructor: num_samples must be >= 3 |
|
Virtual method to compute/guess the tangent of the new added i-th sample. MUST be redefined by subclasses that use tangents in order to properly initialize unspecified tangents. MAY change the tangents of previous samples using the new i-th sample information. [OSCAR] Currently used for splines only Reimplemented from Interpolator. |
|
Evaluates the function in t using the specific interpolation method (defined in a subclass). Implements Interpolator. |