Re: clarification request

Charles,

Yes, it is rather confusing when you concatenate multiple path segments'
worth of coordinates after a single instruction letter.

However, the apparent contradiction in the two statements you quoted stems
from the fact that you are interpretting the word "command" to mean
"command letter and all subsequent coordinates"; in contrast, the specs use
it to mean each individual path segment or move command.

Although you can skip the letter that starts a command, it is still
considered a distinct "command" for calculation of relative points.  From
there, the rule is that each relative command is calculated relative to the
end point of the previous command.

In other words, for a relative curve, both the control points and the end
point are relative to the start point.  That is what the sentence in 8.3.1
describes.  If you then added another set of coordinates, however, those
would be a separate curve command, relative to the end point of the first
curve.

For the particular sentence in 8.3.1, I would suggest the following
clarification:

For the relative versions of the commands, all coordinate values are
relative to the current point at the start of the command.  Relative
coordinates for each command are calculated separately, based on the start
point for that path segment or move operation, regardless of whether the
command letter has been omitted in the path data.


In other words,

   - "M0,0h 5 5 5" would draw a horizontal line 15 units long (each
   coordinate added to the previous one), but
   - "M0,0c5,0 0,5 0,0" would draw a curve that looped back to the starting
   point (the control points do not affect the position of the end point).

Where it gets really confusing is when you omit the letter in multiple
relative curve commands:

   -  "M0,0c5,0 0,5 5,5 -5,0 0,-5 -5,-5" would draw a curve from 0,0 to 5,5
   and then the exact reverse curve back over top; the first three coordinates
   (first curve command) are relative to 0,0, but the next set (second curve
   command) are relative to 5,5.

All three examples in one SVG: http://codepen.io/AmeliaBR/pen/JoYNEZ

Amelia BR

On 28 November 2014 at 11:26, Charles Law <charles.law@gmail.com> wrote:

> I would like to add a clarification to some of the path command
> descriptions for relative commands.  I look at this spec every once in a
> while for a random project, and I always wonder, what are the points
> relative to?  I end up making a small SVG to test out what happens.
> I am looking specifically at 8.3.2 The "moveto" commands.  I request to
> change:
>
> "If a moveto is followed by multiple pairs of coordinates, the subsequent
> pairs are treated as implicit lineto commands."
>
> to
>
> "If a moveto is followed by multiple pairs of coordinates, the subsequent
> pairs are treated as implicit lineto commands, and relative points will be
> relative to the previous pair of points."
>
> The lineto command could use a similar clarification.  I haven't tested
> that out though.
>
> I also find this sentance in 8.3.1 confusing:
>
> "For the relative versions of the commands, all coordinate values are
> relative to the current point at the start of the command."
>
> If it is technically true, it's misleading in the moveto case.
>
> Also, if I got anything wrong, feel free to correct.  I mostly want to
> help make the docs clearer.
> Thanks,
> Charles
>

Received on Monday, 1 December 2014 21:27:37 UTC