On Sun, 4 Sep 2005, David Arnold wrote:
I find myself working my way through John Hobby's "Drawing Graphs with Metapost" again. In Figure 9, the following code has me confused:
glabel.lft(image(unfill bbox lab[j]; draw lab[j]), length p[j]);
I understand that the glabel command will put the label in this case at the "knot" length p[j]. But when he adds .7, I don't understand why the labels move down.
glabel.lft(image(unfill bbox lab[j]; draw lab[j]), 0.7+length p[j]);
Can someone help me with this?
(just a try) it seems that gfill converts the given path to some internal representation, see graph.mp, using macro Gucvi_. So after gfill, the total path (and its length) has been extended to p[j]--reverse p[j-1]... So after the end of path p[j] there comes a vertical line down "--" to reverse p[j-1]. The glabel.lft picks this extended path by its length parameter. With 0.0+length p[j] your box would go left from end of path p[j], with 1.0+length p[j] it would go left from end of path p[j-1], with e. g. 20+length p[j] it goes back along path p[j-1]... Regards, Hartmut