summaryrefslogtreecommitdiff
path: root/fonts/astro/astrosym.mac
blob: e1013d30b20e21873ac734ad6c4a0570ccbf4e24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
% ASTROSYM.MAC : AstroSym (Version 2.20,  Aug. 10, 2002) - file 3 of 8
% Peter Schmitt                      eMail: Peter.Schmitt@univie.ac.at
% Institute of Mathematics, University of Vienna       Vienna, Austria
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%% variables

numeric r,R,D, a,b, s,t; %H,V,

pair 
 TL,Tl,TC,Tr,TR,
 tL,tl,tC,tr,tR,
 CL,Cl,CC,Cr,CR,
 bL,bl,bC,br,bR,
 BL,Bl,BC,Br,BR;

pair BB,MM,TT, mm, LL,RR, ll,rr, HH,VV, vv,nn, hh,vv,nn;

pair vP,hP, vp,hp, vd,hd; 

%% values for corrections needed in calligraphic style            % mar99
%%        ( zero for uniform stroke )

def pP = if p=P : 0 else: p# fi enddef;   % p or 0      % not (yet?) used
def Pp = if p=P : 0 else: P# fi enddef;   % P or 0

picture temp;

%%%%%%%% macros

def  PEN = pickup pencircle scaled 2P  enddef;
def SPEN = pickup pensquare scaled 2P  enddef;
def DPEN = pickup (pensquare rotated 45) scaled 2P  enddef;  % added aug02
def RPEN = pickup penrazor  scaled 2P  enddef;
def  Pen = pickup pencircle scaled 2p; enddef;

%%  line with RPEN ( maximal breadth )            % added mar99
def RLine ( expr PP, QQ ) =
    aa := angle ( PP - QQ ) ;
    RPEN rotated (aa+90) ;
         draw PP--QQ;
         % ( QQ + ( hP rotated aa ) );     % potential extension
    enddef;

%% replacement for RLine for uniform strokes
%% only needed for efficiency
def Line ( expr PP, QQ ) =
    PEN; draw PP--QQ;
    enddef;
% let RLine=Line;

%%% auxilary macro : changing end of stroke from PEN to SPEN  % 14feb99

def REND ( expr endpoint, direction ) =
    RPEN rotated (direction+90) ;
%        draw endpoint--( endpoint + ( Pp*(1,0) rotated direction ) );
         draw endpoint--( endpoint + ( ( if p=P : (0,0) else : hP fi )
                                       rotated direction ) );
    enddef;
%%%

def corrections =
    vP:=(0,P); hP:=(P,0);
    vp:=(0,p); hp:=(p,0);
    vd:=vP-vp; hd:=hP-hp;
    enddef;

def Corners (expr lft_corr, rt_corr, bot_corr, top_corr) =
    BL := (0+lft_corr,-d+bot_corr); BR := (w-rt_corr,-d+bot_corr);
    TL := (0+lft_corr, h-top_corr); TR := (w-rt_corr, h-top_corr);
    enddef;
def corners = Corners (P,P,P,P); enddef;

def Centers (expr x_ratio,y_ratio) =
    BC:=bot x_ratio[BL,BR]; TC:=top x_ratio[TL,TR];
    CL:=lft y_ratio[BL,TL]; CR:= rt y_ratio[BR,TR]; 
    CC:=y_ratio[BC,TC];
    enddef;
def Centers (expr x_ratio,y_ratio) =
    BC:=x_ratio[BL,BR]; TC:=x_ratio[TL,TR];
    CL:=y_ratio[BL,TL]; CR:=y_ratio[BR,TR]; 
    CC:=y_ratio[BC,TC];
    enddef;
def centers = Centers (1/2,1/2); enddef;

def TOP (expr lft_ratio,rt_ratio) =
    Tl:=lft_ratio[TL,TR]; Tr:=rt_ratio[TL,TR];
    enddef;
def BOT (expr lft_ratio,rt_ratio) =
    Bl:=lft_ratio[BL,BR]; Br:=rt_ratio[BL,BR];
    enddef;
def HOR (expr lft_ratio,rt_ratio) =
    BOT(lft_ratio,rt_ratio); TOP(lft_ratio,rt_ratio);
    enddef;

def Bot (expr ratio) =
    bl:=ratio[Bl,Tl]; bC:=ratio[BC,TC]; br:=ratio[Br,Tr];
    enddef;
def Top (expr ratio) =
    tl:=ratio[Bl,Tl]; tC:=ratio[BC,TC]; tr:=ratio[Br,Tr]; 
    enddef;

def LFT (expr bot_ratio,top_ratio) =
    bL:=bot_ratio[BL,TL]; tL:=top_ratio[BL,TL]; 
    enddef;
def RT (expr bot_ratio,top_ratio) =
    bR:=bot_ratio[BR,TR]; tR:=top_ratio[BR,TR]; 
    enddef;

def Fill (expr boundary) =
    fill boundary; draw boundary;
    enddef;

def ARROW (expr base,top, breadth, lcorr,bcorr) =
    vv := top-base;
    nn := breadth*(vv rotated 90)/2;
    BB := base; TT := top; 
    LL := base+nn-lcorr*vv; RR := base-nn-lcorr*vv;
    ll := .5[base,top]+(1-bcorr)*nn/2;
    rr := .5[base,top]-(1-bcorr)*nn/2;
    enddef;

def arrow (expr base,top, breadth, lcorr,bcorr) =
    ARROW (base,top, breadth, lcorr,bcorr);
    Fill ( LL{dir angle(ll-LL)}..{dir angle(TT-ll)}TT
         & TT{dir angle(rr-TT)}..{dir angle(RR-rr)}RR
         & RR{dir angle(BB+lcorr*vv-RR)}..BB..{dir angle(LL-BB-lcorr*vv)}LL
         ..cycle );
    enddef;

def Arrow (expr base,top, breadth, lcorr,bcorr) =
    ARROW (base,top, breadth, lcorr,bcorr);
    draw LL{dir angle(ll-LL)}..{dir angle(TT-ll)}TT
       & TT{dir angle(rr-TT)}..{dir angle(RR-rr)}RR;
    draw BB--TT;
    enddef;

def cross (expr base,top, breadth, base_corr) =
    vv := (top-base-(0,base_corr));
    nn := breadth*(vv rotated 90)/2;
    BB := base; TT := top;
    MM := .5[base+(0,base_corr),top];
    LL := MM-nn; RR := MM+nn;
    draw LL--RR; draw BB--TT;
    enddef;

def Circle (expr cc, hh, vv) =
    draw (cc-vv)..(cc-hh)..(cc+vv)..(cc+hh)..(cc-vv)..cycle;
    enddef;

endinput;
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% end of ASTROSYM.MAC %%%