[NTG-context] MetaFun: How to draw bent paths?

Henri Menke henrimenke at gmail.com
Tue Sep 18 11:23:55 CEST 2018


On 9/18/18 7:57 PM, Hans Hagen wrote:
> On 9/16/2018 10:28 AM, Henri Menke wrote:
>> Dear list,
>>
>> I want to draw paths between points which are bent by a certain angle.
>> The code in the MWE below works well but I was thinking that the expert
>> here can surely improve it and suggest a nicer syntax.
> looks like a challenge for Alan ... isn't it also a bit 3d (2.5d)?

I wasn't thinking about a 3D application here, just a little bend on the
path to go around other elements in my drawing without having to think
about explicit control points (like the second example in my original
post).  In the meantime I have improved the defintion of the macro to
avoid double computation of the angle:

    vardef bend(expr a,b,phi) =
        save x ;
        x := angle(b-a) ;
        a{dir(x+phi)} .. {dir(x-phi)}b
    enddef ;

So currently the applied syntax is

    drawarrow bend(z1, z2, 30) ;

However, I would prefer something like

    drawarrow z1 bend(30) z2 ;

I'm not sure whether this is possible though.  Actually I'm reading the
MetaPost manual right know because my MP skills are rather poor.

> 
> -----------------------------------------------------------------
>                                           Hans Hagen | PRAGMA ADE
>               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -----------------------------------------------------------------
> ___________________________________________________________________________________
> 
> If your question is of interest to others as well, please add an entry
> to the Wiki!
> 
> maillist : ntg-context at ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________



More information about the ntg-context mailing list