W3C home > Mailing lists > Public > www-svg@w3.org > May 2007

RE: Creating a bezier curve with defined data-set

From: Dr. Olaf Hoffmann <Dr.O.Hoffmann@gmx.de>
Date: Thu, 10 May 2007 12:33:41 +0200
To: www-svg@w3.org, bimal.thomas@cgi.com
Message-Id: <200705101233.41872.Dr.O.Hoffmann@gmx.de>


the best you can get is a cubic bezier curve in SVG,
this requires control points. The control points are
related to the derivative of the curve.
To get a 'smooth' curve, the derivatives of the
curve fragments have to fit together, this means,
the curve has to be continuously differentiable.
In general for an arbitrary set of points you need
a cubic bezier curve to get a continuously differentiable
If you know the derivative at your 20 points, it is
easy to determine the control points with minor
mathematics, because the parametrization of a
cubic bezier curve is well known and therefore the
derivative from the parametrization parameter too.
If you don't know the derivate, the best you can
do is (to believe and) to calculate a spline interpolation.
Because it is possible to calculate the control points
of a cubic bezier curve from a cubic spline interpolation,
the problem is reduced on the question, how to determine
the best spline interpolation for your data set.
This is a well known mathematical problem. A set
of linear equations have to be solved to fit your data
to a cubic spline. This linear equation system can
be reduced to a problem of matrix diagonalisation.
If you have the mathematics for this or a library to
do this, you have the best fitting cubic spline for
your data set and it is simple mathematics to determine
the control points of the cubic beziers.

Hope this helps...
Received on Thursday, 10 May 2007 10:32:02 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:29:34 UTC