Re: Number of vertices unclear, when using closepath command

From: Regina Henschel <rb.henschel@t-online.de>
Date: Sat, 02 Nov 2013 21:06:11 +0100
Message-ID: <52755B33.2030400@t-online.de>

```Hi Jasper, hi all,

Jasper van de Gronde schrieb:
> On 2013-10-30 11:27, Regina Henschel wrote:
>> Hi all,
>>
>> while implementing an SVG import for Apache OpenOffice, we come across
>> this problems:
>>
>> Take this path definitions
>> (A) d="m40,20 -20,10 30,10 z l10,-10"
>> and
>> (B) d="m40,20 -20,10 30,10 z m0 0 l10,-10"
>>
>> Which vertices exists? How many markers are created and what
>> directions have these markers?
> The spec states (section 8.3.3): "If a "closepath" is followed
> immediately by a "moveto", then the "moveto" identifies the start point
> of the next subpath. If a "closepath" is followed immediately by any
> other command, then the next subpath starts at the same initial point as
> the current subpath." So from that point of view both of these paths
> consist of two subpaths with 3 and 1 segments, respectively, with the
> same vertices.

It is clear, that there are three line segments for the first subpath
and one line segment for the second subpath. But see it from the view of
a point. All agree, that the point (20|30) has one incoming line segment
and one outgoing line segment. But the point (40|20)?

>
> Now, the spec says (section 11.6.3) that marker-start "defines the
> arrowhead or polymarker that shall be drawn at the first vertex of the
> given ‘path’ element or basic shape". A little further in that same
> paragraph it seems to be implied that "first" and "last" should be
> considered to apply to subpaths (rather than the entire path), and that
> in the event of a closed subpath the first and last vertex should be
> considered the same (and that one might thus have to draw two markers at
> the same position, depending on the values of marker-start and
> marker-mid). It would thus seem that for both paths you should have the
> following sequence of markers: start mid mid end start end.

It was already cleared, that there is no marker-end or marker-start in
between, but only at the start and end of the whole path, see thread
http://lists.w3.org/Archives/Public/www-svg/2013Sep/0041.html

>
> Markers are a little tricky though. When it comes to the orientation the
> spec seems to imply (section 11.6.2, explanation of the orient
> attribute) that if a closepath is followed by an explicit moveto, the
> orientation of the end marker corresponding to the closepath should be
> the same as the orientation for the starting point of the subpath closed
> by the closepath, and that the orientation can be found by considering
> the last and first segments of that subpath (the one that is closed by
> the closepath), or alternatively that this just holds for the start
> marker, and that the end marker just acts like that path ends completely
> at that point (but that seems weird). However, when a closepath is /not/
> followed by a moveto, you should take the the last segment of the
> subpath closed by the closepath (so the line segment drawn by the
> closepath) and the first segment of the /subsequent/ path. (Confusingly,
> in the latter case the orientation of the marker corresponding to the
> start of the second subpath does not appear to be altered...)

It seems to be not clear. For example, test the files contained in the
.zip file in https://issues.apache.org/ooo/attachment.cgi?id=81841

Internet Explorer has marker-start and two marker-mid on point (40|20)
in case B, but only marker-start and one marker-mid in case A. It might
paint the marker of the second subpath identical to the end of the first
subpath, on top of each other; not able to rule it out only from view.

Seamonkey too has 1+2 markers in case B and 1+1 markers in case A. But
it draws the marker-start different from Internet Explorer.

Inkscape shows 1+2 markers in both cases with identical orientations,
which I think is wrong because of the explicit rule in section 11.6.2.

Chrome has 1+2 markers in both cases, but orientations are different
from the other implementations. That both cases are identical, seem
wrong to me, same as for Inkscape.

>
> In summary: (as far as I can tell) both paths have the exact same
> vertices and /types/ of markers, the orientations do differ though. In
> the first case the orientation of the marker corresponding to the
> closepath will be determined by the line segment corresponding to the
> close path (from [30,10] to [40,20]) and the final line segment (from
> [40,20] to [10,-10]), the orientation of the marker corresponding to the
> first point of the second subpath would be solely determined by the
> final line segment (from [40,20] to [10,-10]). In the second case the
> two subpaths are essentially handled separately.
>> Is stroke-linejoin or stroke-linecap used in point (40|20)?
>> For example B
>> stroke-linejoin between lines (40|20)(20|30) and (50|40)(40|20)
>> and on top of it
>> stroke-linecap from line (40|20)(50|10)
> Not sure about linecaps/-joins, but I hope the above will at least
> provide a bit more insight. I would follow the references given above
> and have a careful look yourself, there are quite a few corner cases and
> exceptions. (Be sure to also have a look at the 'path' element
> implementation notes: section F.5.)
>

If reading the spec gave an unambiguous solution, there would not be so
many different implementations.

Kind regards
Regina
```
Received on Saturday, 2 November 2013 20:06:41 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:47:34 UTC