Giuseppe Bilotta wrote:

Does MetaFun provide some macro to draw oriented paths? I
would like it to basically add a small arrow *in the middle*
of the path? Such a macro

draworiented somepath somespecs ;

would have to act like

drawarrow firsthalf(somepath) somespecs ;
draw secondhalf(somepath) somespecs ;

Is it available already, or should I roll my own?

it's there; watch out, i just added a scaling option

\starttext

\setupcolors[state=start]

\startMPpage

vardef arrowheadonpath (expr p, s) =
 save autoarrows ; boolean autoarrows ; autoarrows := true ;
 set_ahlength(scaled ahfactor) ; % added
 arrowhead p if s<1 : cutafter (point (s*arclength(p)+.5ahlength) on p) fi
enddef ;

path p ; p := (0,0)--(10cm,10cm) ;

draw p withcolor red ;
ahfactor := 5 ; % default is 2.5
fill arrowheadonpath(p,.5) withcolor blue ; % try .25

currentpicture := currentpicture xsized (10cm) ;
\stopMPpage

\stoptext

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to