ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cal/cal/reinhart.cal
Revision: 1.2
Committed: Thu Jul 2 21:37:52 2009 UTC (14 years, 10 months ago) by greg
Branch: MAIN
Changes since 1.1: +2 -2 lines
Log Message:
Fixed bug where bin past maximum occassionally generated

File Contents

# Content
1 { RCSid $Id: reinhart.cal,v 1.1 2009/07/01 00:39:34 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 June 2009 G. Ward
9 }
10 DEGREE : PI/180;
11 Asin(x) : if(x-1, PI/2, if(-1-x, -PI/2, asin(x)));
12 posangle(a) : if(-a, a + 2*PI, a);
13 Atan2(y,x) : posangle(atan2(y,x));
14
15 alt = Asin(Dz)/DEGREE;
16 azi = Atan2(Dx,Dy)/DEGREE;
17
18 MF : 2^2; { Multiplication factor }
19 alpha : 90/(MF*7 + .5); { Separation between rows in degrees }
20 { Number of patches per row }
21 tnaz(r) : select(r, 30, 30, 24, 24, 18, 12, 6);
22 rnaz(r) : if(r-(7*MF-.5), 1, MF*tnaz(floor((r+.5)/MF) + 1));
23
24 raccum(r) : if(r-.5, rnaz(r-1) + raccum(r-1), 0);
25
26 r_row = floor(alt/alpha);
27
28 r_inc = 360/rnaz(r_row);
29
30 r_azn = if(360-.5*r_inc - azi, floor((azi+.5*r_inc)/r_inc), 0);
31
32 rbin = if (-alt, 0, raccum(r_row) + r_azn + 1);
33
34 Nrbins : raccum(7*MF+1) + 1; { total number of bins }