1 |
{ RCSid $Id: reinhart.cal,v 1.3 2009/09/15 00:17:36 greg Exp $ } |
2 |
{ |
3 |
Compute Reinhart high-density sky patches |
4 |
Actual density controlled by MF constant |
5 |
|
6 |
Modified from Tregenza.cal |
7 |
|
8 |
Need to specify MF constant before loading (usu. power of two) |
9 |
|
10 |
June 2009 G. Ward |
11 |
} |
12 |
DEGREE : PI/180; |
13 |
Asin(x) : if(x-1, PI/2, if(-1-x, -PI/2, asin(x))); |
14 |
posangle(a) : if(-a, a + 2*PI, a); |
15 |
Atan2(y,x) : posangle(atan2(y,x)); |
16 |
|
17 |
alt = Asin(Dz)/DEGREE; |
18 |
azi = Atan2(Dx,Dy)/DEGREE; |
19 |
|
20 |
alpha : 90/(MF*7 + .5); { Separation between rows in degrees } |
21 |
{ Number of patches per row } |
22 |
tnaz(r) : select(r, 30, 30, 24, 24, 18, 12, 6); |
23 |
rnaz(r) : if(r-(7*MF-.5), 1, MF*tnaz(floor((r+.5)/MF) + 1)); |
24 |
|
25 |
raccum(r) : if(r-.5, rnaz(r-1) + raccum(r-1), 0); |
26 |
|
27 |
r_row = floor(alt/alpha); |
28 |
|
29 |
r_inc = 360/rnaz(r_row); |
30 |
|
31 |
r_azn = if(359.9999-.5*r_inc - azi, floor((azi+.5*r_inc)/r_inc), 0); |
32 |
|
33 |
rbin = if (-alt, 0, raccum(r_row) + r_azn + 1); |
34 |
|
35 |
Nrbins : raccum(7*MF+1) + 1; { total number of bins } |