I hope I get to see the final file. Nice work. On Jun 26, 2006, at 4:04 PM, Hans Hagen wrote:
> Mojca Miklavec wrote: >> On 6/27/06, Hans Hagen wrote: >> >>> Mojca Miklavec wrote: >>> >>>> To Hans: thanks for the hint! (Slowly starting to believe that the >>>> code might indeed reach 4 lines ;) >>>> >>>> >>> another one: >>> >>> vardef mytransform(expr pathorpicture) = >>> pathorpicture >>> if reflect=2: >>> reflectedabout((0,0),(1,1)) >>> elseif reflect=3: >>> reflectedabout((0,0),(1,-1)) >>> elseif reflect=4: >>> reflectedabout((-1,0),(1,0)) >>> fi >>> enddef; >>> >>> -) >>> >> >> What a waste of space ;) ! >> >> vardef mytransform(expr pathorpicture) = >> pathorpicture >> if reflect > 1: reflectedabout( >> if reflect=2: (0,0),(1,1) >> elseif reflect=3: (0,0),(1,-1) >> elseif reflect=4: (-1,0),(1,0) >> fi) >> fi >> enddef; >> >> (Slowly starting to believe that MP might become as horrible & >> unreadable as perl ;) >> >> > that's why i seldom go that far > > but the if inside an expresion is ok for me (many languages provide > that) > > of course a clean solution is: > > transform _mt_[] ; reflect := 1 ; > > _mt_[1] := identity ; > _mt_[2] := identity reflectedabout(( 0,0),(1, 1)) ; > _mt_[3] := identity reflectedabout(( 0,0),(1,-1)) ; > _mt_[4] := identity reflectedabout((-1,0),(1, 0)) ; > > vardef mytransform(expr p) = p transformed _mt_[reflect] enddef; % one > line -) > > draw mytransform(fullcircle scaled 10cm) ; > > draw fullcircle scaled 4cm transformed _mt_[reflect] ; > > > Hans > > ----------------------------------------------------------------- > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com > | www.pragma-pod.nl > ----------------------------------------------------------------- > > _______________________________________________ > ntg-context mailing list > ntg-context@ntg.nl > http://www.ntg.nl/mailman/listinfo/ntg-context _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context