[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] pic: how to fill a diamond shape?

From: Louis Guillaume
Subject: Re: [Groff] pic: how to fill a diamond shape?
Date: Wed, 11 Mar 2009 08:48:14 -0400
User-agent: Thunderbird (Macintosh/20081209)

(Ted Harding) wrote:
box wid 2 ht 2 at (0,0)
"\v'-0.22m'\D'p 1i -1i 1i 1i -1i 1i -1i -1i'" at (-1,0)
box wid 2 ht 2 at (0,-3)
"\v'-0.22m'\D'P 1i -1i 1i 1i -1i 1i -1i -1i'" at (-1,-3)

where "\v'-0.5n'" has been replaced by "\v'-0.22m'". This was
based on looking at the 'pic' output for

line right "xxx"

where I saw:

\h'0.000i'\v'0.000i'\D'l0.500i 0.000i'
.sp -1
.lf 2

It's still an empirical rather than a principled solution,
but at least it is based on better evidence!


Thank you for this, Ted. It is very strange and I can't seem to figure out what's going on beyond the 0.22m "adjustment". So (still using empirical methods) here's what I'm seeing...


"\D'Fr #ddffdd'"
"\D'P 1i -0.5i 1i 0.5i -1i 0.5i -1i -0.5i'"


This gives me a nice green diamond (or kite, I think). It's left point is centered on the page and everything appears to look good. Because after all we did draw to the right and we are starting in the middle (pic's default). One would expect the current point after the drawing to be on the left point of the kite... but it isn't.

The kite has been rendered off vertically by 0.22m (above) as you've pointed out. I guess pic knows about this and makes the adjustment appropriately when drawing shapes.

So I need to adjust the kite's position up by 0.22m to meet the current point.


"\D'Fr #ddffdd'"
"\v'-0.22m'\D'P 1i -0.5i 1i 0.5i -1i 0.5i -1i -0.5i'"
arrow down


The arrow starts precisely on the left point. Nice!

Ok now Let's move the whole deal over by 1 inch so we can have the thing centered nicely...


"\D'Fr #ddffdd'"
"\v'-0.22m'\h'-1i'\D'P 1i -0.5i 1i 0.5i -1i 0.5i -1i -0.5i'"
move down 0.5i
arrow down


.... AAA!! It only moves over 1/2". If I move it over by 2 inches it lines up as I want it to. So the \h is cut in half for some (unknown to me) reason.

The polygon we created does not have the normal pic attributes that we can refer to. My original kite with lines and a box was ok, but I think that since the polygon isn't drawn with pic, we can't refer directly to the n,s,e,w etc. points on the object.

What I'm stuck doing is referring to the box within my "decision()" function. Not ideal, but workable.


define decision {
  move down 0.5i
  "\D'Fr #ddffdd'"
  "\v'-0.22m'\h'-2i'\D'P 1i -0.5i 1i 0.5i -1i 0.5i -1i -0.5i'"
  move down 0.5i
  "\v'-0.22m'\D'p -1i -0.5i 1i -0.5i 1i 0.5i -1i 0.5i'"
  DBOX: box wid $1 ht $2 invis $3

circle "start"
decision(2,1,"Decision" "Box")
arrow right from DBOX.e
circle "END"


It would be nice to have a "polygon" command in pic that works

    polygon closed shaded "green" up right 1 then \
      down right 1 then down left 1

and have it "know" where the position in the current context is so that it is drawn at the last object (say a line) in the proper direction, just like a box.

One more thing - How can I refer to my dimensions (which are being passed into the function) in the \v and \h escapes? For example:

  "\D'p $1 $2 $3 $4'"   <-- this doesn't work.

Thanks for looking.


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]