[metapost] Redefine ..

Hans Hagen pragma at wxs.nl
Mon Jun 4 22:34:00 CEST 2012


On 4-6-2012 21:38, Troy Henderson wrote:
>>
>> however, the next challenge is to catch a 'cycle'.
>>
>
> Indeed Hans.  Any thoughts on tackling that?

No at this moment ... I tried a show on the argument but that somewhat 
confusing. Probably best is to have a new symbol


def P (expr a) = (redpart a, greenpart a) enddef ;

def pathnode (expr a) =
     if rgbcolor a :
         P(a)
     else :
         a
     fi
enddef ;

color threeDcycle ; threeDcycle := (4096,-4096,4096) ;

primarydef a .!. b =
     if b = threeDcycle :
         pathnode(a) .. cycle
     else :
         pathnode(a) .. pathnode(b)
     fi
enddef;


draw (1,1,9) .!. (2,1,6) .!. (3,2,5) .!. (4,1,5) .!. threeDcycle ;

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the metapost mailing list