MbCubicFunction Cubic Hermite Function
The MbCubicFunction class is declared in the cur_cubic_function.h file.
The Cubic Hermite function MbCubicFunction is defined by the set of control points valueList, the set of function derivatives at the control points firctList, the set of parameter values of the function at the control points tList, and the flag of periodicity of the function closed. The function also has some additional data that are optional and are used to speed up the work of the function methods.
For the parameter value tList[i], i = 0, 1, …, splinesCount, where splinesCount = tList.MaxIndex(), the Cubic Hermite function passes through the control point valueList[i] and has the derivative firctList[i] at this point. The function is constructed on the basis of splinesCount third-degree Hermite splines, which smoothly join each other. Each cubic Hermite spline describes a segment of the function between two neighboring control points. Each cubic Hermite spline is defined by two end points and two derivatives of the curve at these points.
When evaluating the function, first, by the value of the curve parameter t, the index i of the working segment (the index of the cubic Hermite spline) is determined from the condition tList[i] ≤ t ≤ tList[i + 1]. Then the function is evaluated for the found working segment using its local parameter w, which is defined by tList[i] and tList[i + 1].
In the double Value( double & t ) method, the following function is used:
where
is the local parameter of the working segment tList[i] ≤ t ≤ tList[i + 1].
The Cubic Hermite function is shown in Fig. 1:
Fig. 1
The domain of the function parameter lies within tmin ≤ t ≤ tmax, where tmin = tList[0], tmax = tList[splinesCount]. The function can be periodic.
The shape of the function depends on the positions of the control points, on the function derivatives at the control points, and on the tList set of parameter values at the control points. When the function is constructed only by control points, the derivatives firctList[i] are computed by constructing a parabola that passes through three neighboring points valueList[i – 1], valueList[i], valueList[i + 1] at the corresponding parameter values tList[i – 1], tList[i], tList[i + 1], and by evaluating the derivative of this parabola at the middle point.