From: André W. <wo...@us...> - 2012-05-21 21:00:26
|
Hi Michael, sorry for being late in the discussion. Am 10.05.2012 um 10:28 schrieb Michael J Gruber: > r3151 took into account the direction already but missed the fact that > arrows are positioned wrt. the constriction center now. Make it so that > a reversed arrow is positioned wrt. the constriction center also. To my understanding this is not true. Everything is completely symmetric. For earrows, at pos=0, the "back" of the arrow starts at the starting point of the path and at pos=1 (the default for earrow) the tip is at the end. The same for barrow. At pos=1 the back is at the end of the path and at pos=0 (the default for barrow) the tip is at the beginning. Those limits are correct. In between we're just going linearly. I'm sorry, your circular example is much to complicated for me. Here's my attempt: from pyx import * ···· c = canvas.canvas() c.stroke(path.line(0, 0, 10, 0)) c.stroke(path.line(0, 0, 0, 2)) c.stroke(path.line(0.1, 0, 0.1, 2)) c.stroke(path.line(5, 0, 5, 2)) c.stroke(path.line(9.9, 0, 9.9, 2)) c.stroke(path.line(10, 0, 10, 2)) c.stroke(path.line(0, 0.2, 10, 0.2), [deco.arrow(pos=1)]) # earrow c.stroke(path.line(0, 0.4, 10, 0.4), [deco.arrow(pos=1, reversed=1)]) c.stroke(path.line(0, 0.6, 10, 0.6), [deco.arrow(pos=0.99)]) c.stroke(path.line(0, 0.8, 10, 0.8), [deco.arrow(pos=0.99, reversed=1)]) c.stroke(path.line(0, 1.0, 10, 1.0), [deco.arrow(pos=0.5)]) c.stroke(path.line(0, 1.2, 10, 1.2), [deco.arrow(pos=0.5, reversed=1)]) c.stroke(path.line(0, 1.4, 10, 1.4), [deco.arrow(pos=0.01)]) c.stroke(path.line(0, 1.6, 10, 1.6), [deco.arrow(pos=0.01, reversed=1)]) c.stroke(path.line(0, 1.8, 10, 1.8), [deco.arrow(pos=0)]) c.stroke(path.line(0, 2.0, 10, 2.0), [deco.arrow(pos=0, reversed=1)]) # barrow c.writePDFfile() Now try your patches. It creates a lot of confusion. No way. I think the positioning of the arrows on the circle you're trying to get right should be done using path features. This is trivial: from pyx import * c = canvas.canvas() circ = path.circle(0, 0, 5) p = path.line(0, 0, 5, 5) c.stroke(circ.split(circ.intersect(p)[0][0])[0], [deco.arrow(size=1)]) c.stroke(p) c.writePDFfile() Now, the only problem is if you want to position the "back of the arrow" at the intersection point. I don't know whether it is that useful (technically) but I fully understand that it might be desirable from a visual point of view sometimes. You need to take into account the constriction length of the arrow in question. Unfortunately this was not accessible from the outside. I just checked in a simple patch (changeset 3247). Then it becomes a simple modification of what we had before: from pyx import * c = canvas.canvas() circ = path.circle(0, 0, 5) p = path.line(0, 0, 5, 5) a = deco.arrow(size=1) c.stroke(circ.split(circ.intersect(p)[0][0] + a.constrictionlen)[0], [a]) c.stroke(p) c.writePDFfile() Best, André -- by _ _ _ Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim / \ \ / ) wo...@us..., http://www.wobsta.de/ / _ \ \/\/ / PyX - High quality PostScript and PDF figures (_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/ |