- From: Vincent Hardy <vincent.hardy@sun.com>
- Date: Tue, 03 Dec 2002 10:40:27 +0100
- To: Chris Lilley <chris@w3.org>
- CC: news <news@main.gmane.org>, Niklas Gustavsson <niklas@protocol7.com>, svg-developers@yahoogroups.com, www-svg@w3.org
Hello, Thanks Niklas for reporting that. I have looked into it and there was indeed a bug in Batik which did the wrong math for the last two line segments on the first path and for the last two segments on the polygon. I just commited a fix for that in the Batik code base. Regarding the definition of the bisector 'vector' (i.e., the unit vector defining the direction of the marker's x axis), I think it is implicitly defined as the sum of the tangent vectors on the input and output segments (at least this is how I read the spec) but it might be good to clarify this and be more explicit. Something like: "if I is the input segment's tangent unit vector and O the output segment's tangent unit vector, then, the direction of the marker's x axis is the same as I+O. If I+O is null, then the direction of the marker's x axis is given by the vector orthogonal to I and forming a +90deg angle with I." Thanks, Vincent. P.S: As Thierry pointed out, there is an issue with the arc command in the sample showed, but Batik seems right there. Vincent. Chris Lilley wrote: > 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 .... > >
Received on Tuesday, 3 December 2002 04:46:45 UTC