I've read many articles that describe how to convert cardinal or canonical splines into cubic bezier curves, such as this one.
Is there a way to do the reverse, i.e. convert a set of cubic bezier curves into a cardinal spline? We know, for example, that the endpoints of each curve are on the spline.
What I'm looking for is a way to roundtrip through the two representations with minimal loss of information. Also ideally the solution should be stable, so that going from cubic bezier => cardinal spline => cubic bezier => cardinal spline should result in the same (or nearly same) curves after the second operation.
Imagine cubic curve between points B and E.
If it is defined as cardinal spline with tension parameter s, then tangent vectors in these points are
Tb = s * (E - A)
Te = s * (F - B)
If curve is defined as Bezier one, then tangent vectors are
Tb = 3 * (C - B)
Te = 3 * (E - D)
If curve BE is the same, then values of tangents are equal, and we can find control points of Bezier, if A,B,E,F,s are known. And vice versa - we can find A,F points for cardinal spline, if B,C,D,E,s are known. For example, the first control point of Bezier is
C = B + s * (E - A) / 3
--