[metapost] Redefine ..

Troy Henderson thenders at gmail.com
Mon Jun 4 18:00:03 CEST 2012


I am drawing 3D graphics, and many of my "points" are colors instead of
pairs.  Of course, the colors are projected to pairs eventually, but I
would like to define paths of colors directly with .. by doing something
like

path p;
p:=(1,2,3)..(4,5,6)..(7,8,9);

I have a vardef P that transforms colors into pairs, and thus I can always
just do

p:=P(1,2,3)..P(4,5,6)..P(7,8,9);

but I would like to be able to omit this P usage.  My attempt thusfar is

---
def pathnode primary a =
   if color a:
      P(a)
   else:
      a
   fi;
enddef;

primarydef a .. b =
   pathnode(a) .. pathnode(b)
enddef;
---

but this is not working.  I would appreciate any insight into how I might
fix this so that I can use .. between pairs.

Thanks in advance,

Troy Henderson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/metapost/attachments/20120604/0f80b0e5/attachment.html>


More information about the metapost mailing list