W3C home > Mailing lists > Public > www-svg@w3.org > December 2002

Re: [svg-developers] Marker differences - ASV vs Batik

From: Chris Lilley <chris@w3.org>
Date: Sun, 1 Dec 2002 14:01:57 +0100
Message-ID: <12450667187.20021201140157@w3.org>
To: news <news@main.gmane.org>, "Niklas Gustavsson" <niklas@protocol7.com>
CC: svg-developers@yahoogroups.com, www-svg@w3.org

On Sunday, December 1, 2002, 3:05:06 AM, Niklas wrote:

NG> (cross-post: be warned)

(wondering what news@main.gmane.org is)

NG> Hi all

NG> When doing some experiments with markers I found some differences
NG> between Batik 1.5b4 and ASV3 and I'm unsure to which one is
NG> correct. Please help me out since I can't really judge based on
NG> the spec and I need to know where to send the bug report :-)

I tried it in CSIRO viewer and got a third result... seems to use the
only outgoing tangent, sometimes ..


NG> I used this file:
NG> http://www.protocol7.com/svg.net/tests/marker-01.svg

NG> This produces the following rendering in ASV:
NG> http://www.protocol7.com/svg/markerBugs/asv3.png

NG> (note that the circled arrow should not be there at all. This is
NG> clearly a bug in ASV).
Yes. Perhaps the Q curve is being rendered internally as two curves ....

NG> In Batik it looks like this:
NG> http://www.protocol7.com/svg/markerBugs/batik1.5b4.png

NG> As you can see, the rotation of some of the markers differs
NG> between the two implementations. Which one is correct?

I don't see why the markers in Batik (and CSIRO) flip by 180 degrees
for that first mid vertex on the lower left.

NG> The spec has the following to say about rotations on mid-markers: "if there
NG> is a path segment coming into the vertex and another path segment going out
NG> of the vertex, the marker's positive x-axis should point toward the angle
NG> bisector for the angle at the given vertex, where that angle has one side
NG> consisting of tangent vector for the path segment going into the vertex and
NG> the other side the tangent vector for the path segment going out of the
NG> vertex (note: if the tangent vectors are the same, the angle bisector equals
NG> the two tangent vectors)".
NG> (http://www.w3.org/TR/SVG11/painting.html#MarkerAlgorithm)

NG> This doesn't really help me but for someone more fluent in math it might :-)

OK well the path segments part id obvious I hope, for example M L L Q
T a l z has two straight-line path segments generated by the two L
commands, then one curved path segment generated by the Q and so on.

For mid markers, drawn between two path segments, there is an incoming
path segment (the one nearest the start of the path) and an outgoing
path segment (the next one along, towards the end of the path).

Its easier to see with straight lines so consider the angle formed by
the two L segments. There is a tangent vector (a line at right angles to the
line drawn by the first L) which, for a straight line, is the same
vector all along the line. There is another tangent vector for the
second L. The math verbiage above says that the marker lies along the
average of those two tangent vectors, ie a vector mid way between
them.

Once you get onto curves then the tangent varies along the curve so
the incoming tangent is a line drawn at 90 degrees to the curve just
before the join onto the next path segment, and the outgoing tangent
is a line drawn at 90 degrees to the curve just after the join; and
the marker is once again on a line half way between those tow -
dividing the angle between those two tangents into two.

Hmm it should say the bisector on the shortest arc, clearly there are
two possible bisectors ....  a possible explanation for the flipped
first marker ....


-- 
 Chris                            mailto:chris@w3.org
Received on Sunday, 1 December 2002 08:02:06 GMT

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