[metapost] Arrows in the middle of a path

Taco Hoekwater taco at elvenkind.com
Mon Jul 28 19:36:31 CEST 2008


Oliver Buerschaper wrote:
> Dear MetaPost wizards,
> 
> how can I draw an arrow head right at the middle of a path? So far  
> I've tried

Because of the way drawarrow is defined, doing it perfect is harder
than you would expect, but you can make the input look much better
with a simple macro:

   def midarrow (expr p, t) =
     drawarrow subpath(0,t) of p;
     draw subpath(t,1) of p;
   enddef;

   u := 1cm;
   path p; p := origin -- (0,u);
   midarrow (p, 0.6);

Best wishes, Taco


More information about the metapost mailing list