|
From: Michael J G. <mic...@us...> - 2012-05-23 16:05:51
|
André Wobst venit, vidit, dixit 21.05.2012 22:59: > 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() I think that's a perfect illustration of the current problems: The pos=1 arrow has its tip on the vertical comparison line, the one at 0.99 also. The one at pos=0.5 has "something" on that line (the line interesects the head between the tip and the constriction center). The one at pos=0 and pos=0.01 have their constriction centers on the respective lines. All positioned differently. Also note how the tips of the back of the arrow protrude beyond the vertical line, but the forward tip does not. Compare that to line drawing for accute angles: There, a stroked path will (due to the angle and linewidth) always protrude beyond the corner of the angle. In that sense, enforcing that an arrow tip does not protrude (as it is now) is artificial. But that's probably not going to change. I'm not saying that my patch solves all this - in fact, what you call "confusion" comes from the attempt to provide some backwards compatibility for pos=0 and 1. >From my point of view, pos should be relative to full arclength, and barrow and earrow should do whatever is needed so that they come out unchanged (say, earrow would have pos= (arclen-constricionlen/arclen)). Simply because that is the most natural, controllable and mathematically sane. But I see I'm facing an uphill battle. And no, splitting a path for every decoration that I put there is not a solution. Just thing of annotating an integration path. Do you really suggesting stroking it piecewise, or over and over again? The beauty of the deco module in PyX is the fact that you have *one* path carrying allow decorations (text labels, arrow heads and what not). For that you have to be able to position them consistently (say, text label at pos for arrow at pos). Michael |