Martijn<br>I'll trust your maths on this but it still only offsets a single segment.  <br><br>You would need to do this for each segment in a path and you would need to deal with the ends of each segment.  A lateral shift means that the end of one segment would no longer connect up to the start of the next.  I suppose you could add a pseudo segment to bridge that gap though.
<br><br>One other approach that might work would be to use the close paths algorithm to fill one side of a path.  You could then paint over it a slightly wider stroke and use the first path as a mask.  I think this would mask out the wider path on the filled side but leave it showing on the other side as a thin asymmetrical stroke.
<br><br>BTW the next version of Osmarender will have the ability to apply masks to paths, so if this works theoretically then all that would be necessary would be a reasonable close paths algorithm (in XSL anybody?).<br><br>
Etienne<br><br><div><span class="gmail_quote">On 7/2/07, <b class="gmail_sendername">Martijn van Oosterhout</b> <<a href="mailto:kleptog@gmail.com">kleptog@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On 7/2/07, Frederik Ramm <<a href="mailto:frederik@remote.org">frederik@remote.org</a>> wrote:<br>> But wouldn't you have to individually compute the offset for every<br>> line segment using trigonometric functions if you want a constant
<br>> distance between the original path and the offset path?<br><br>I wonder. (If anyone spots errors in the reasoning below, let me know).<br><br>Say you have a line going from (a,b) to (c,d). What you really want is
<br>a transformation that translates (0,0) to (a,b) and rotates the world<br>so (c,d) is somewhere along the x-axis. This rotation requires the<br>angle and trig functions, or so you think. Assume the length of the<br>line is L. Then:
<br><br>sin(theta) = (d-b)/L<br>cos(theta) = (c-a)/L<br><br>Thus with the following SVG transforms:<br><br>transform(a,b) scale(1/L) matrix( c-a d-b b-d c-a 0 0 )<br><br>You map the line (L,0) to the original line and a line (L,1) will be
<br>parallel and one pixel offset. This requires no trig functions and<br>should be within the capability of XSLT, right?<br><br>(The proof is in the pudding I suppose, I'll try it out this afternoon).<br><br>What do you think?
<br>--<br>Martijn van Oosterhout <<a href="mailto:kleptog@gmail.com">kleptog@gmail.com</a>> <a href="http://svana.org/kleptog/">http://svana.org/kleptog/</a><br></blockquote></div><br>