[NTG-context] MetaFun: Rotate picture without rotating labels

Henri Menke henrimenke at gmail.com
Fri Apr 6 01:13:37 CEST 2018


On Fri, 2018-04-06 at 11:05 +1200, Henri Menke wrote:
> Dear list,
> 
> In the MWE below I would like py to be px rotated by 90 degrees but the labels
> should not be rotated.  Is it possible?
> 
> Cheers, Henri
> 
> ---

I thought of using vardef but that is kind of verbose because I gave to repeat
"rotated angle" three times.

\startMPpage
  vardef orbital(expr angle) =
    save p ;
    path p ;
    p := origin .. (2,1) .. (3,0) .. (2,-1) .. (-2,1) .. (-3,0) .. (-2,-1) .. cycle ;
    image (
      draw p scaled 6 rotated angle;
      label("\strut$+$",(+10,0) rotated angle);
      label("\strut$-$",(-10,0) rotated angle);
    )
  enddef ;

  picture px, py ;
  px := orbital ( 0) ;
  py := orbital (90) ;

  draw px ;
  draw py ;
\stopMPpage

> 
> \startMPpage
> 
>   path p ; p := origin .. (2,1) .. (3,0) .. (2,-1) .. (-2,1) .. (-3,0) .. (-
> 2,-1) .. cycle ;
>   picture px, py ;
>   px := image (
>     draw p scaled 6 ;
>     label("$+$",(+10,0));
>     label("$-$",(-10,0));
>   ) ;
>   py := px rotated 90 ;
> 
>   draw px ;
>   draw py ; % meh :/
> 
> \stopMPpage
> 


More information about the ntg-context mailing list