ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cal/cal/rskysrc.cal
Revision: 1.3
Committed: Wed Nov 27 18:44:43 2019 UTC (4 years, 5 months ago) by greg
Branch: MAIN
CVS Tags: rad5R4, rad5R3, HEAD
Changes since 1.2: +4 -5 lines
Log Message:
Removed definition of MF that didn't belong

File Contents

# Content
1 { RCSid $Id: rskysrc.cal,v 1.2 2009/07/14 16:16:20 greg Exp $ }
2 {
3 Reinhart sky patch positions & solid angles
4
5 Greg Ward June 2009
6
7 Based on tregsrc.cal
8 MF constant controls patch density, and should be assigned in advance
9
10 Input is Rbin from 1-(144*MF^2+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 alpha : 90/(MF*7 + .5); { Separation between rows in degrees }
18 { Number of patches per row }
19 tnaz(r) : select(r, 30, 30, 24, 24, 18, 12, 6);
20 rnaz(r) : if(r-(7*MF-.5), 1, MF*tnaz(floor((r+.5)/MF) + 1));
21
22 raccum(r) : if(r-.5, rnaz(r-1) + raccum(r-1), 0);
23
24 RowMax : 7*MF + 1;
25 Rmax : raccum(RowMax);
26
27 Rfindrow(r, rem) : if(rem-rnaz(r)-.5, Rfindrow(r+1, rem-rnaz(r)), r);
28 Rrow = if(Rbin-(Rmax-.5), RowMax, Rfindrow(0, Rbin));
29 Rcol = Rbin - raccum(Rrow) - 1;
30
31
32 Razi_width = 2*PI / rnaz(Rrow);
33
34 RAH : alpha*DEGREE;
35
36 Razi = (Rcol + x2 - .5)*Razi_width;
37 Ralt = (Rrow + x1)*RAH;
38
39 Romega = if(Rmax-.5-Rbin,
40 Razi_width*(sin(RAH*(Rrow+1)) - sin(RAH*Rrow)),
41 2*PI*(1 - cos(RAH/2)) );
42
43 cos_ralt = cos(Ralt);
44
45 Dx = sin(Razi)*cos_ralt;
46 Dy = cos(Razi)*cos_ralt;
47 Dz = sqrt(1 - cos_ralt*cos_ralt);
48
49 theta = 2/DEGREE * acos(1 - Romega/(2*PI));