ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cal/cal/rskysrc.cal
Revision: 1.2
Committed: Tue Jul 14 16:16:20 2009 UTC (14 years, 9 months ago) by greg
Branch: MAIN
CVS Tags: rad5R2, rad4R2P2, rad5R0, rad5R1, rad4R2, rad4R1, rad4R0, rad4R2P1
Changes since 1.1: +3 -3 lines
Log Message:
Minor fix in over-range test

File Contents

# Content
1 { RCSid $Id: rskysrc.cal,v 1.1 2009/07/01 00:39:34 greg Exp $ }
2 {
3 Reinhart sky patch positions & solid angles
4
5 Greg Ward June 2009
6
7 Based on tregsrc.cal
8 MF controls patch density
9
10 Input is Rbin from 1-(144*MF+1) and optional x1 x2 random variables
11 Output is Dx Dy Dz theta (degree full angle of source)
12 }
13 DEGREE : PI/180;
14
15 x1 = .5; x2 = .5; { default rand. var. settings for midpoint }
16
17 MF : 2^2; { Multiplication factor }
18 alpha : 90/(MF*7 + .5); { Separation between rows in degrees }
19 { Number of patches per row }
20 tnaz(r) : select(r, 30, 30, 24, 24, 18, 12, 6);
21 rnaz(r) : if(r-(7*MF-.5), 1, MF*tnaz(floor((r+.5)/MF) + 1));
22
23 raccum(r) : if(r-.5, rnaz(r-1) + raccum(r-1), 0);
24
25 RowMax : 7*MF + 1;
26 Rmax : raccum(RowMax);
27
28 Rfindrow(r, rem) : if(rem-rnaz(r)-.5, Rfindrow(r+1, rem-rnaz(r)), r);
29 Rrow = if(Rbin-(Rmax-.5), RowMax, Rfindrow(0, Rbin));
30 Rcol = Rbin - raccum(Rrow) - 1;
31
32
33 Razi_width = 2*PI / rnaz(Rrow);
34
35 RAH : alpha*DEGREE;
36
37 Razi = (Rcol + x2 - .5)*Razi_width;
38 Ralt = (Rrow + x1)*RAH;
39
40 Romega = if(Rmax-.5-Rbin,
41 Razi_width*(sin(RAH*(Rrow+1)) - sin(RAH*Rrow)),
42 2*PI*(1 - cos(RAH/2)) );
43
44 cos_ralt = cos(Ralt);
45
46 Dx = sin(Razi)*cos_ralt;
47 Dy = cos(Razi)*cos_ralt;
48 Dz = sin(Ralt);
49
50 theta = 2/DEGREE * acos(1 - Romega/(2*PI));