ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cal/cal/reinhart.cal
Revision: 1.4
Committed: Wed Dec 9 21:34:23 2009 UTC (14 years, 4 months ago) by greg
Branch: MAIN
CVS Tags: rad5R4, rad5R2, rad4R2P2, rad5R0, rad5R1, rad4R2, rad4R1, rad4R0, rad4R2P1, rad5R3, HEAD
Changes since 1.3: +3 -2 lines
Log Message:
Made it so MF must be specified before loading file

File Contents

# Content
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 }