Dirk

I have posted this on the wiki, but not tested.

http://therion.speleo.sk/wiki/doku.php/metapost#special_symbol_examples

 

Bruce

 


From: Dirk Peinelt [mailto:dirk.peinelt@t-online.de]
Sent: Thursday, 9 June 2016 7:35 a.m.
To: 'Martin Sluka'; Bruce Mutton
Subject: AW: [Therion] Therion Digest, Vol 126, Issue 7

 

Hi Martin, Bruce,

the definition may be published to the wiki.

I’dont know if the code is effective. (I’ve not used the A-D Pens.)

 

I combine this compass rose with a creation date in the map-header (/currentdate).

A date variable is not present in metapost.

 

If the CS is not set, the declination is Zero.

Also if the declination is Zero, the northarrow is a Nmag arrow:

North grid/true rotate the whole plan with the north arrow. (merid. Conv.?)

 

A small change… (I hope i am not mistaken.)

 

 

 

def s_northarrow (expr rot) =

              valscal=1.2; % scale your north arrow here

              decl:=MagDecl;

              T:=identity;

              picture tmp_pic;

              tmp_pic = image (

                            pickup pencircle scaled .3;

                            thfill fullcircle scaled 4cm withcolor 1white;

                            thdraw fullcircle scaled 3.1cm;

                            thdraw fullcircle scaled 4.05cm;

                            pickup pencircle scaled .1;

                            thdraw fullcircle scaled 3cm;

                            thdraw fullcircle scaled 4cm;

                            pickup pencircle scaled .2;

                            thdraw (dir(45)*2.025cm)--(dir(45)*3.7cm);

                            thdraw (dir(135)*2.025cm)--(dir(135)*3.7cm);

                            thdraw (dir(225)*2.025cm)--(dir(225)*3.7cm);

                            thdraw (dir(315)*2.025cm)--(dir(315)*3.7cm);

                            pickup pencircle scaled .1;

                            for whereto=0 step 15 until 345:

                              thdraw dir(whereto)*.65cm--dir(whereto)*.9cm;

                              thdraw dir(whereto)*1.4cm--dir(whereto)*1.5cm;

                            endfor;

                            for whereto=0 step 5 until 355:

                              thdraw dir(whereto)*.65cm--dir(whereto)*.8cm;

                              thdraw dir(whereto)*1.45cm--dir(whereto)*1.5cm;

                            endfor;

                            for whereto=0 step 1 until 359:

                              thdraw dir(whereto)*1.94cm--dir(whereto)*2cm;

                            endfor;

                            pickup pencircle scaled 1;

                            thdraw fullcircle scaled 1cm;

                            thdraw fullcircle scaled 1.1cm;

                            thdraw fullcircle scaled 1.3cm withpen pencircle scaled .3;

                            vald=90-decl;

                            texrot=0-decl;

                            drawarrow(dir(vald)*-2cm--dir(vald)*2cm) withpen pencircle scaled .2;

                            if (MagDecl <> 0): thdraw image(label.top(btex $mg$ etex, (0,0)) scaled .5 rotated texrot;) shifted (dir(vald)*2.04cm); fi;                                              

                            thfill (1.06cm,1.06cm)--(0,.2cm)--(-1.06cm,1.06cm)--(-.2cm,0)--(-1.06cm,-1.06cm)--(0,-.2cm)--(1.06cm,-1.06cm)--(.2cm,0)--cycle;

                            thfill (-.2cm,.2cm)--(0,2cm)--(0,0)--cycle;

                            thfill (.2cm,-.2cm)--(0,-2cm)--(0,0)--cycle;

                            thfill (.2cm,.2cm)--(2cm,0)--(0,0)--cycle;

                            thfill (-.2cm,-.2cm)--(-2cm,0)--(0,0)--cycle;

                            thfill (.2cm,.2cm)--(-0,2cm)--(0,0)--cycle withcolor 1white;

                            thfill (.2cm,-.2cm)--(2cm,0)--(0,0)--cycle withcolor 1white;

                            thfill (-.2cm,-.2cm)--(0,-2cm)--(0,0)--cycle withcolor 1white;

                            thfill (-.2cm,.2cm)--(-2cm,0)--(0,0)--cycle withcolor 1white;                                    

                            pickup pencircle scaled .2;

                            thdraw (-.2cm,.2cm)--(0,2cm)--(.2cm,.2cm)--(2cm,0cm)--(.2cm,-.2cm)--(0,-2cm)--(-.2cm,-.2cm)--(-2cm,0)--cycle;

                            thfill fullcircle scaled .56cm withcolor 1white;

                            pickup pencircle scaled .1;

                            thdraw (.28cm,0)..(0,.28cm)..(-.28cm,0)..(0,-.28cm)..cycle;

                            pickup pencircle scaled .4;

                            thdraw (.2cm,0)..(0,.2cm)..(-.2cm,0)..(0,-.2cm)..cycle;

                            if (MagDecl = 0): label.bot(btex $Nmag$ etex, (0,2.6cm)); else: label.bot(btex $N$ etex, (0,2.6cm)); fi;

                            label.lft(btex $E$ etex, (2.6cm,0));

                            label.rt(btex $W$ etex, (-2.6cm,0));

                            label.top(btex $S$ etex, (0,-2.6cm));

              );

              thdraw tmp_pic scaled valscal rotatedaround(origin, -rot);

enddef;

 

 

//dirk