| 1 |
% ASTROSYM.MAC : AstroSym (Version 2.20, Aug. 10, 2002) - file 3 of 8 |
| 2 |
% Peter Schmitt eMail: [email protected] |
| 3 |
% Institute of Mathematics, University of Vienna Vienna, Austria |
| 4 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 5 |
|
| 6 |
%%%%%%%% variables |
| 7 |
|
| 8 |
numeric r,R,D, a,b, s,t; %H,V, |
| 9 |
|
| 10 |
pair |
| 11 |
TL,Tl,TC,Tr,TR, |
| 12 |
tL,tl,tC,tr,tR, |
| 13 |
CL,Cl,CC,Cr,CR, |
| 14 |
bL,bl,bC,br,bR, |
| 15 |
BL,Bl,BC,Br,BR; |
| 16 |
|
| 17 |
pair BB,MM,TT, mm, LL,RR, ll,rr, HH,VV, vv,nn, hh,vv,nn; |
| 18 |
|
| 19 |
pair vP,hP, vp,hp, vd,hd; |
| 20 |
|
| 21 |
%% values for corrections needed in calligraphic style % mar99 |
| 22 |
%% ( zero for uniform stroke ) |
| 23 |
|
| 24 |
def pP = if p=P : 0 else: p# fi enddef; % p or 0 % not (yet?) used |
| 25 |
def Pp = if p=P : 0 else: P# fi enddef; % P or 0 |
| 26 |
|
| 27 |
picture temp; |
| 28 |
|
| 29 |
%%%%%%%% macros |
| 30 |
|
| 31 |
def PEN = pickup pencircle scaled 2P enddef; |
| 32 |
def SPEN = pickup pensquare scaled 2P enddef; |
| 33 |
def DPEN = pickup (pensquare rotated 45) scaled 2P enddef; % added aug02 |
| 34 |
def RPEN = pickup penrazor scaled 2P enddef; |
| 35 |
def Pen = pickup pencircle scaled 2p; enddef; |
| 36 |
|
| 37 |
%% line with RPEN ( maximal breadth ) % added mar99 |
| 38 |
def RLine ( expr PP, QQ ) = |
| 39 |
aa := angle ( PP - QQ ) ; |
| 40 |
RPEN rotated (aa+90) ; |
| 41 |
draw PP--QQ; |
| 42 |
% ( QQ + ( hP rotated aa ) ); % potential extension |
| 43 |
enddef; |
| 44 |
|
| 45 |
%% replacement for RLine for uniform strokes |
| 46 |
%% only needed for efficiency |
| 47 |
def Line ( expr PP, QQ ) = |
| 48 |
PEN; draw PP--QQ; |
| 49 |
enddef; |
| 50 |
% let RLine=Line; |
| 51 |
|
| 52 |
%%% auxilary macro : changing end of stroke from PEN to SPEN % 14feb99 |
| 53 |
|
| 54 |
def REND ( expr endpoint, direction ) = |
| 55 |
RPEN rotated (direction+90) ; |
| 56 |
% draw endpoint--( endpoint + ( Pp*(1,0) rotated direction ) ); |
| 57 |
draw endpoint--( endpoint + ( ( if p=P : (0,0) else : hP fi ) |
| 58 |
rotated direction ) ); |
| 59 |
enddef; |
| 60 |
%%% |
| 61 |
|
| 62 |
def corrections = |
| 63 |
vP:=(0,P); hP:=(P,0); |
| 64 |
vp:=(0,p); hp:=(p,0); |
| 65 |
vd:=vP-vp; hd:=hP-hp; |
| 66 |
enddef; |
| 67 |
|
| 68 |
def Corners (expr lft_corr, rt_corr, bot_corr, top_corr) = |
| 69 |
BL := (0+lft_corr,-d+bot_corr); BR := (w-rt_corr,-d+bot_corr); |
| 70 |
TL := (0+lft_corr, h-top_corr); TR := (w-rt_corr, h-top_corr); |
| 71 |
enddef; |
| 72 |
def corners = Corners (P,P,P,P); enddef; |
| 73 |
|
| 74 |
def Centers (expr x_ratio,y_ratio) = |
| 75 |
BC:=bot x_ratio[BL,BR]; TC:=top x_ratio[TL,TR]; |
| 76 |
CL:=lft y_ratio[BL,TL]; CR:= rt y_ratio[BR,TR]; |
| 77 |
CC:=y_ratio[BC,TC]; |
| 78 |
enddef; |
| 79 |
def Centers (expr x_ratio,y_ratio) = |
| 80 |
BC:=x_ratio[BL,BR]; TC:=x_ratio[TL,TR]; |
| 81 |
CL:=y_ratio[BL,TL]; CR:=y_ratio[BR,TR]; |
| 82 |
CC:=y_ratio[BC,TC]; |
| 83 |
enddef; |
| 84 |
def centers = Centers (1/2,1/2); enddef; |
| 85 |
|
| 86 |
def TOP (expr lft_ratio,rt_ratio) = |
| 87 |
Tl:=lft_ratio[TL,TR]; Tr:=rt_ratio[TL,TR]; |
| 88 |
enddef; |
| 89 |
def BOT (expr lft_ratio,rt_ratio) = |
| 90 |
Bl:=lft_ratio[BL,BR]; Br:=rt_ratio[BL,BR]; |
| 91 |
enddef; |
| 92 |
def HOR (expr lft_ratio,rt_ratio) = |
| 93 |
BOT(lft_ratio,rt_ratio); TOP(lft_ratio,rt_ratio); |
| 94 |
enddef; |
| 95 |
|
| 96 |
def Bot (expr ratio) = |
| 97 |
bl:=ratio[Bl,Tl]; bC:=ratio[BC,TC]; br:=ratio[Br,Tr]; |
| 98 |
enddef; |
| 99 |
def Top (expr ratio) = |
| 100 |
tl:=ratio[Bl,Tl]; tC:=ratio[BC,TC]; tr:=ratio[Br,Tr]; |
| 101 |
enddef; |
| 102 |
|
| 103 |
def LFT (expr bot_ratio,top_ratio) = |
| 104 |
bL:=bot_ratio[BL,TL]; tL:=top_ratio[BL,TL]; |
| 105 |
enddef; |
| 106 |
def RT (expr bot_ratio,top_ratio) = |
| 107 |
bR:=bot_ratio[BR,TR]; tR:=top_ratio[BR,TR]; |
| 108 |
enddef; |
| 109 |
|
| 110 |
def Fill (expr boundary) = |
| 111 |
fill boundary; draw boundary; |
| 112 |
enddef; |
| 113 |
|
| 114 |
def ARROW (expr base,top, breadth, lcorr,bcorr) = |
| 115 |
vv := top-base; |
| 116 |
nn := breadth*(vv rotated 90)/2; |
| 117 |
BB := base; TT := top; |
| 118 |
LL := base+nn-lcorr*vv; RR := base-nn-lcorr*vv; |
| 119 |
ll := .5[base,top]+(1-bcorr)*nn/2; |
| 120 |
rr := .5[base,top]-(1-bcorr)*nn/2; |
| 121 |
enddef; |
| 122 |
|
| 123 |
def arrow (expr base,top, breadth, lcorr,bcorr) = |
| 124 |
ARROW (base,top, breadth, lcorr,bcorr); |
| 125 |
Fill ( LL{dir angle(ll-LL)}..{dir angle(TT-ll)}TT |
| 126 |
& TT{dir angle(rr-TT)}..{dir angle(RR-rr)}RR |
| 127 |
& RR{dir angle(BB+lcorr*vv-RR)}..BB..{dir angle(LL-BB-lcorr*vv)}LL |
| 128 |
..cycle ); |
| 129 |
enddef; |
| 130 |
|
| 131 |
def Arrow (expr base,top, breadth, lcorr,bcorr) = |
| 132 |
ARROW (base,top, breadth, lcorr,bcorr); |
| 133 |
draw LL{dir angle(ll-LL)}..{dir angle(TT-ll)}TT |
| 134 |
& TT{dir angle(rr-TT)}..{dir angle(RR-rr)}RR; |
| 135 |
draw BB--TT; |
| 136 |
enddef; |
| 137 |
|
| 138 |
def cross (expr base,top, breadth, base_corr) = |
| 139 |
vv := (top-base-(0,base_corr)); |
| 140 |
nn := breadth*(vv rotated 90)/2; |
| 141 |
BB := base; TT := top; |
| 142 |
MM := .5[base+(0,base_corr),top]; |
| 143 |
LL := MM-nn; RR := MM+nn; |
| 144 |
draw LL--RR; draw BB--TT; |
| 145 |
enddef; |
| 146 |
|
| 147 |
def Circle (expr cc, hh, vv) = |
| 148 |
draw (cc-vv)..(cc-hh)..(cc+vv)..(cc+hh)..(cc-vv)..cycle; |
| 149 |
enddef; |
| 150 |
|
| 151 |
endinput; |
| 152 |
%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 153 |
%%% end of ASTROSYM.MAC %%% |