ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cal/cal/klems_ang.cal
Revision: 1.1
Committed: Fri Jun 18 00:56:15 2010 UTC (13 years, 10 months ago) by greg
Branch: MAIN
CVS Tags: rad4R2P2, rad5R0, rad4R2, rad4R1, rad4R2P1
Log Message:
Created calculation of direction vector from Klems bin

File Contents

# Content
1 { RCSid $Id$ }
2 {
3 Compute central Klems direction vector from kbin (1-145)
4
5 6/17/2010 G. Ward
6 }
7
8 DEGREE : PI/180;
9
10 Kfull_theta(i) : select(i, 5, 15, 25, 35, 45, 55, 67, 75, 90);
11 Kfull_nphis(i) : select(i, 1, 8, 16, 20, 24, 24, 24, 16, 12);
12 Khalf_theta(i) : select(i, 6.5, 19.5, 32.5, 46.5, 61.5, 76.5, 90);
13 Khalf_nphis(i) : select(i, 1, 8, 12, 16, 20, 12, 4);
14 Kqrtr_theta(i) : select(i, 9, 27, 46, 66, 90);
15 Kqrtr_nphis(i) : select(i, 1, 8, 12, 12, 8);
16
17 { Change these assignments for a different basis }
18 rtheta(i) = Kfull_theta(i);
19 nphis(i) = Kfull_nphis(i);
20
21 theta_bin(t, cnt) : if(nphis(t) - cnt - .5, t,
22 theta_bin(t+1, cnt-nphis(t)));
23 nphis_above(t) : if(t - 1.5, nphis(t-1)+nphis_above(t-1), 0);
24
25 tbin = theta_bin(1, kbin-1);
26 { angles are in degrees}
27 theta = if(tbin - 1.5, .5*(rtheta(tbin)+rtheta(tbin-1)), 0);
28 phi = 360*(kbin-1 - nphis_above(tbin))/nphis(tbin);
29
30 { solid angle in steradians }
31 omega = if(tbin - 1.5,
32 2*PI*(cos(rtheta(tbin-1)*DEGREE)-cos(rtheta(tbin)*DEGREE))/nphis(tbin),
33 2*PI*(1 - cos(rtheta(1)*DEGREE)));
34
35 sintheta = sin(theta*DEGREE);
36 { actual direction vector }
37 Dx = sintheta*cos(phi*DEGREE);
38 Dy = sintheta*sin(phi*DEGREE);
39 Dz = sqrt(1 - sintheta*sintheta);