W3C home > Mailing lists > Public > www-svg@w3.org > January 2013

Re: SVG2 - suggestion for a new path command to close a subpath smoothly

From: Dr. Olaf Hoffmann <Dr.O.Hoffmann@gmx.de>
Date: Sun, 6 Jan 2013 15:07:47 +0100
To: www-svg@w3.org
Message-Id: <201301061507.48312.Dr.O.Hoffmann@gmx.de>
Rik Cabanier:
> Hi,
>
> It would be good to see the formula's that derive the strength of the
> control points. Even better would be a small library that implements them
> so  people can experiment with the results.
> Thinking about it some more, I'm less concerned with arc since the
> 'direction' of the last control point is probably constant with respect to
> precision.
> We'd still need to specify what would happen to Catmull-Rom.
>

Meanwhile I have put together something to analyse and to play with:
http://hoffmann.bplaced.net/svgueb/pathclosedform.xhtml

With one form one can provide points and control points to get a closed 
cubic curve as result.
If required, one can use another form to convert affine and quadratic paths
to cubic paths.
Currently such a conversion is not defined in SVG.
But the used formulas can be useful as well to extent the option for
the animation of path data as well, even beyond the improvements
of SVG tiny 1.2, currently unfortunately not available in the SVG 2 draft.

To learn something about (closed and open) Catmull-Rom, I found out, 
that this is the same as low quality interpolation, maybe already known before
Leibniz and Newton - it turned out, that I tried this with SVG already years 
ago, but to call this simple method Catmull-Rom seems to be new, not
available in my books about mathematics from the end of the last century ;o)
As an example I provide approximations of a circle for  comparison - as 
expected, with the same number of points, the quality of  Catmull-Rom
is pretty low, therefore one needs a lot of points to get a useful result
(title elements provide information about the meaning of the curves).
But this is a general problem of this low quality interpolation and 
is not related to open or closed boundary conditions.
Using slightly more advanced interpolation formulas, one gets much
better results, what can be tested with an approximation of  an 
elliptical arc as well.

However, because derivatives for elliptical arcs are known, if one wants
to close such segments as well, one should better use the derivatives
to determine the closing (cubic) segment instead of using an approximation.
But I think, it is of very limited use to provide an option to close path data
with elliptical arcs smoothly with a cubic segment, because this is a 
completely other curve type than cubic, quadratic and affine segments
represent.


Olaf
Received on Sunday, 6 January 2013 14:08:16 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:53 GMT