SVG export of cubic beziers

Discuss SVG code, accessible via the XML Editor.
roplacebo
Posts: 2
Joined: Tue May 31, 2011 9:42 pm

SVG export of cubic beziers

Postby roplacebo » Tue May 31, 2011 10:08 pm

Hello!

When I export to plain SVG, Inkscape exports cubic bezier's as follows:

Code: Select all

C 53.439856,43.061276 54.021886,43.138425 54.42033,43.292713 C 54.818761,43.447018 55.13712,43.719479 55.375408,44.110096 ...


Is this correct?
There are only 6 values for a single cubic Bézier
I would expect 8 values..

http://www.w3.org/TR/SVG/paths.html

User avatar
tomh
Posts: 218
Joined: Sat Feb 14, 2009 10:14 pm

Re: SVG export of cubic beziers

Postby tomh » Wed Jun 01, 2011 12:41 am

"A path is described using the concept of a current point. In an analogy with drawing on paper, the current point can be thought of as the location of the pen. The position of the pen can be changed, and the outline of a shape (open or closed) can be traced by dragging the pen in either straight lines or curves."

Going to use Lineto as an example.
1 start at 0,0. then lineto command to x,y - two coordinates, next lineto x2,y2 - goes from where the last line finished (x,y) to (x2,y2). Otherwise you would always be repeating an unnecessary pair of coordinates

so L 24,30 L10,10

means line from 0,0 (implicit starting point) to 24,30 and then line from 24,30 (current point) to 10,10

- the same is true for the cubic path.

"current point to (x,y) using (x1,y1) as the control point at the beginning of the curve and (x2,y2) "

so here there are 4 coordinates. The "current point" is implicit in the command.

roplacebo
Posts: 2
Joined: Tue May 31, 2011 9:42 pm

Re: SVG export of cubic beziers

Postby roplacebo » Wed Jun 01, 2011 1:34 am

You're right.
I got confused by the following:

Code: Select all

M 0.56860747,99.953934 C 0.56860747,99.953934 3.9321343,0.79252452 99.957367,0.55888648


The moveto command has the same values than the first control point of the curveto
which led me to the conclusion, that the latter was the starting point of the curve,
which it isn't.

Thanks, R.


Return to “SVG / XML Code”