[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: |
Ted Harding |
Subject: |
RE: [Groff] pic: how to fill a diamond shape? |
Date: |
Mon, 09 Mar 2009 21:08:55 -0000 (GMT) |
Improvement: see below!
On 09-Mar-09 20:43:11, Ted Harding wrote:
> On 09-Mar-09 03:44:33, Louis Guillaume wrote:
>> Hi,
>> I'm making a flowchart with pic and I want to fill a "decision"
>> diamond, which is drawn like this...
>>
>> define decision {
>> DECA: box invis wid $1 ht $2 $3
>> line from DECA.w to DECA.n then to DECA.e then to DECA.s then to
>> DECA.w
>> }
>>
>> ... is there a better way to draw the diamond? Or perhaps close the
>> path made by the four lines so that it can be filled?
>>
>> Louis
>
> Have a look at the following and see if you can adapt to do
> what you want:
>
> .PS
> box wid 2 ht 2 at (0,0)
> "\v'-0.5n'\D'p 1i -1i 1i 1i -1i 1i -1i -1i'" at (-1,0)
> box wid 2 ht 2 at (0,-3)
> "\v'-0.5n'\D'P 1i -1i 1i 1i -1i 1i -1i -1i'" at (-1,-3)
> .PE
>
>
> It is based on the fact that, when you tell 'pic' to draw a unit
> "box", it outputs
>
> \h'0.750i'\v'0.500i'\D'p0.000i -0.500i -0.750i 0.000i 0.000i 0.500i'
>
> In other words it uses troff's \D'p ... ' "polygon" drawing
> command. With \D'p ... ' you get the outline of the polygon.
> If you use \D'P ... ' instead, you get a filled polygon (with
> the current fill-value).
>
> The "\v'-0.5n'" was put in empirically!
>
> Hoping this helps, and please repot back!
> Ted.
Instead of the above, have a look at the slightly modified version:
.PS
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)
.PE
.sp
.LP
where "\v'-0.5n'" has been replaced by "\v'-0.22m'". This was
based on looking at the 'pic' output for
.PS
line right "xxx"
.PE
where I saw:
\h'0.000i'\v'0.000i'\D'l0.500i 0.000i'
.sp -1
.lf 2
\h'0.250i-(\w'xxx'u/2u)'\v'0.000i-(0v/2u)+0v+0.22m'xxx
It's still an empirical rather than a principled solution,
but at least it is based on better evidence!
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 094 0861
Date: 09-Mar-09 Time: 21:08:53
------------------------------ XFMail ------------------------------