W3C home > Mailing lists > Public > www-svg@w3.org > November 2006

Re: SVG Tiny 1.2 CR2006-08-10: path data

From: Dr. Olaf Hoffmann <Dr.O.Hoffmann@gmx.de>
Date: Mon, 6 Nov 2006 19:59:18 +0200
To: www-svg@w3.org
Cc: nand.kumar@catalytic.com
Message-Id: <200611061859.18625.Dr.O.Hoffmann@gmx.de>

Hello,

>Its good idea to convert the quadratic curve to cubic curve. Great !
>But what about the smooth quadratic curve and smooth cubic curves.
>What about the calculation of the arc length of the quadratic and cubic
>curves.

>Thanks in advance
>Nand

I think, what you mean are the commands T and S (or s and t) -
the expansion to Q and C is already mentioned in the specification.
It has to be done by the viewer.
This is straight forward. If you now it for Q -> C the problem is
solved, because the paths are already normalised from small to large 
letters, T -> Q -> C and S -> C, therefore it is only the question, 
why not L -> C...

The pathLength of the curve is implictely known to the viewer,
the viewer has to calculate it for some applications anyway.
There is the attribute pathLength for the author to correct
the result of the viewer. The result is available in the DOM too,
of course only with scripting, not in the declarative/XML part.
I you want to do it as an author, there are a simple formulars to
calculate the pathLength:
http://en.wikipedia.org/wiki/Arc_length
Note, that the pathLength always exists for Beziers in SVG, not
for any curve in general (think about fractal curves with a fractal
dimension larger than 1).

In most cases this has to be done numerically, as far as I can
see in general for cubic and quadratic beziers too. 
But I did not look very carefully in the books, if there are some
general antiderivatives for theses types of integrals to give
an analytical solution for a quadratic or cubic bezier, for a
linear it is easy. For elliptical arcs (not part of SVG Tiny 1.2) it
is well known, that you have to do it numerically.
Received on Monday, 6 November 2006 18:07:07 GMT

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