|Subject:||How to convert cubic spline presentation into Bezier form?|
|Posted by:||Alex74 (inf…@web.de)|
|Date:||1 Dec 2006|
How to convert cubic spline presentation into Bezier form?
I'm looking for some algorithms/code on how to convert piecewise cubic
spline form into piecewise Bezier spline form.
Some explanation: I've some X/Y data points, which must be
interpolated with Akima (or some other, previously defined) method.
This method produces piecewise parametrical cubic spline, in each
interval the Y-Value for the corresponding X-Value can be calculated as
int iInterval = method.GetIntervall(X, method.xDataVector);
if (iInterval < 0) iInterval = 0; // extrapolate to the left
if (iInterval == (method.xDataVector.size())-1) iInterval--; //
extrapolate to the right
double dXDistance = u - method.xDataVector[iInterval];
double Y=method.yDataVector[iInterval] + dXDistance *
(method.y1DerivVector[iInterval] + dXDistance *
(method.y2DerivVector[iInterval] + dXDistance *
With this method it is possible to calculate explicitly X/Y-values pair
for each screen-pixel. But if the is no pixel-device, coordinates are
real numbers or we must store "the spline", this method is not
really useful. One possibility is to deal with Bezier-Splines. The main
idea is to calculate well-defined spline from the original data points,
convert the calculated spline-parameters (they are splines of cubic
form) into shape-equivalent Bezier-form (P1,C1,C2,P2) and doing all
other stuff with Bezier splines. The Bezier spline should not be
calculated directly from the original data points because of such
Bezier spline does not satisfy specifically conditions.
It would be really very awesome, if somebody can help me with this math
Many thanks in advice.