A while ago in one of the online meetings it was pointed out that one can feed aa point list in metafun using a lua table.
I haven't been able to figure out how to do that.
Has any one a hint?

At presnt I use a script to generate the path directly in MP but easily run out of memory tokens when the drawing is complex enough.

is there a way to define a function to draw a particular line passing its coords and pen and color?

do_line(path, pen, color)

where path is a list of x,y points?




8<---
\usecolors[crayola]
\startMPpage[offset=5mm]
path p;
pen q[];
q[1] := pencircle xscaled 0.3mm yscaled 0.20mm  ;
q[2] := pencircle xscaled 0.3mm yscaled 0.35mm  ;
q[3] := pencircle xscaled 0.3mm yscaled 0.50mm  ;
q[4] := pencircle xscaled 0.3mm yscaled 0.65mm  ;
q[5] := pencircle xscaled 0.3mm yscaled 0.80mm  ;
p := (447,531)..(440,534)..(436,541)..(440,547)..(448,546)..(455,542)..(458,535)..(447,531); draw p withpen q[1] rotated 25 withcolor "black"; p := (67,373)..(69,380)..(67,373)..(64,365)..(67,373); draw p withpen q[5] rotated 30 withcolor "black";
p := (64,91)..(64,91); draw p withpen q[1] rotated 34 withcolor "black";
p := (131,133)..(131,133); draw p withpen q[1] rotated 30 withcolor "black";

...

p := (436,264)..(433,271)..(430,279)..(426,286)..(422,293)..(418,299)..(414,306)..(410,313)..(408,321)..(416,323)..(422,319)..(428,312)..(434,306)..(432,313)..(429,321)..(429,329)..(435,335)..(442,338)..(448,344)..(451,352)..(451,359)..(455,350)..(457,341)..(459,332)..(460,323)..(461,313)..(462,303)..(462,294)..(461,285)..(460,277)..(457,267)..(452,259)..(447,252)..(440,254)..(436,264); draw p withpen q[4] rotated 27 withcolor "black"; p := (266,464)..(262,470)..(263,478)..(271,478)..(274,471)..(266,464); draw p withpen q[5] rotated 35 withcolor "black"; p := (108,401)..(108,408)..(106,401)..(104,393)..(108,401); draw p withpen q[5] rotated 30 withcolor "black";


\stopMPpage

--->8




___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to