Re: Handling of orient="auto" markers

Hi Paul,

You said that the implementations are very quirky and inconsistent. It would be extremely helpful if you have tests that you can share with the community. Quite often there edge cases not respected by implementations and specifications because of a lack of tests. Do you have some test cases?

I did not have the time to review your analysis but will do it before the next F2F meeting.

Greetings,
Dirk

On May 25, 2013, at 10:25 AM, Paul LeBeau <paul.lebeau@gmail.com> wrote:

> Hi all
> 
> When I was implementing my SVG renderer, the Marker section was one of the head-scratchiest parts of the spec to try and understand and get right.  It did not help that pretty much all SVG renderers have bugs (or "quirks") in their marker handling so there wasn't any consensus to go on.
> 
> I notice the SVG 2 spec is a bit better, but I think the section on "auto" oriented markers is still a bit confusing.
> 
> 'auto'
> A value of 'auto' indicates that the marker is oriented such that its positive x-axis is pointing in the direction of the path at the point it is placed.
> 
> If the marker is a segment marker, then the direction the marker is oriented is, if considering the incoming and outgoing directions as unit vectors, in the direction of the sum of these two vectors. If this sum is zero, then the marker is oriented in the incoming direction.
> 
> Is this a typo? Seems like this should be referring to a vertex marker.
> 
> If the marker is on the first or last vertex of a closed subpath, [..snip..]
> 
> I think it is not obvious in all cases what the "first" and "last" vertex is.  If the last point in the subpath does not coincide with the first point, we are told to draw a line to the start point. In this case, which point is the "last" point?  Also should we be drawing a start marker, an end marker, or both?
> 
> My feeling that in a closed subpath, there is conceptually no real start or end point. All vertexes should be considered mid points and only midpoint markers should be rendered.  So my proposed replacement for this section would be as follows:
> ------------------------------------------
> 'auto'
> A value of 'auto' indicates that the marker is oriented such that its positive x-axis is pointing in the direction of the path at the point it is placed.
> 
> If the marker is a vertex marker, then the direction the marker is oriented is, if considering the incoming and outgoing directions as unit vectors, in the direction of the sum of these two vectors. If this sum is zero, then the marker is oriented in the incoming direction.
> 
> If there are two or more consecutive points in a path that coincide exactly (both their x and y values are the same) then all the consecutive coinciding points should be treated as if they were a single vertex.
> 
> If the marker is on the first vertex of a closed subpath, then the outgoing direction is taken from the first path segment and the incoming direction is taken from:
> 	• the last path segment of the subpath, if the last point coincides with the first point, or
> 	• the line drawn from the last point to the start point, if they do not coincide.
> For closed subpaths, the marker definition to be rendered for all vertexes is the marker specified by marker-mid. No start or end markers should be applied.
> ------------------------------------------
> 
> That last paragraph might be a bit controversial, but for closed subpaths I think it makes sense.  As I said, from my testing, renderers rarely agree on how markers are positioned at the start/end of closed subpaths, so I don't think making this change would affect too many people.
> 
> I also have a suggestion for an enhancement:
> ------------------------------------------
> 'auto-start'
> A value of 'auto-start' behaves exactly the same as 'auto' except for the treatment of the start marker.  If a subpath is not closed, then the start marker is positioned so that it points in the exact opposite direction (inverse vector) to the first path segment.
> ------------------------------------------
> 
> The idea is that would allow for the easy creation of double-ended arrows, for example, without having to define two markers.
> 
> This is my first contribution to this list, so if I am an idiot, go easy on me! :)
> 
> Paul

Received on Saturday, 25 May 2013 22:06:54 UTC