[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Groff] pic - drawing a line back to the beginning
From: |
Ted Harding |
Subject: |
RE: [Groff] pic - drawing a line back to the beginning |
Date: |
Tue, 17 Oct 2006 09:24:10 +0100 (BST) |
On 17-Oct-06 Larry Kollar wrote:
> I got busy learning pic today, since there was only a
> tantalizing reference to a utility that doesn't seem to
> exist anymore. :-) Turns out that pic is a fairly simple
> way to produce flowcharts... mostly. I was surprised at
> how quickly I got something that just needed some tweaking,
> not having done anything quite so complex with pic before,
> but ran into a glitch at the end. This is representative
> of what I had to work around (interesting part at the end).
>
> .PS
> down;
> box wid 1 "xyzzy";
> arrow;
> box "plugh";
> arrow;
> box "plove";
>#
># here's the part I'm interested in
> line left from last box .w;
> line up to 1st box .w + (-0.5,0);
> arrow to 1st box .w;
> .PE
>
> One can get a straight line by adjusting the coordinates
> in the next-to-last line, although for a more complex chart
> (like the real one was), it might take several iterations.
> On my computer, I get a left, up, then a diagonal instead
> of just left & diagonal. (PS file attached.)
>
> I was wondering if anyone could: 1) explain why the dogleg
> appears; 2) provide a more elegant method of drawing a line
> back up to the first box that doesn't require guesswork.
Hi Laryy,
Werner has produced a solution which utilises the "named object"
feature of pic, which allows considerable generality (especially
iin complex cases).
There is another little feature, though, which is worth
bearing in mind (and lurks in a corner of the documentation).
If you have a designation of a point (such as "1st box .w")
then you can get its x and y coordinates using ".x" and ".y".
Thus, in the case of your example, a straightforward solution
would be:
.PS
down;
box wid 1 "xyzzy";
arrow;
box "plugh";
arrow;
box "plove";
#
# here's the part I'm interested in
line left from last box .w;
# draw a line up of length equal to the difference of
# the y coordinates:
line up ( 1st box .w .y - last box .w .y );
arrow to 1st box .w;
.PE
The examples given in the original pic manual are (Section 6):
You can use the height, width, radius, and x and y
coordinates of any object or corner in an expression:
Box1.x # the x coordinate of the center of Box1
Box1.ne.y # the y coordinate of the northeast corner of Box1
Box1.wid # the width of Box1
Box1.ht # amd its height
2nd last circle.rad # the radius of the 2nd last circle
And so on.
Best wishes,
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 094 0861
Date: 17-Oct-06 Time: 09:24:06
------------------------------ XFMail ------------------------------