ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/klems_quarter.cal
Revision: 1.2
Committed: Sat Jul 19 00:30:03 2014 UTC (9 years, 9 months ago) by greg
Branch: MAIN
Changes since 1.1: +2 -2 lines
Log Message:
Corrected comment information

File Contents

# User Rev Content
1 greg 1.2 { RCSid $Id: klems_quarter.cal,v 1.1 2014/07/19 00:28:38 greg Exp $ }
2 greg 1.1 {
3 greg 1.2 Compute interior bin for quarter Klems BSDF basis (0-40)
4 greg 1.1 Returns -1 for wrong-side rays
5    
6     Modified from klems_full.cal
7    
8     7/18/2014 G. Ward
9     }
10     DEGREE : PI/180;
11     Acos(x) : if(x-1, 0, if(-1-x, PI, acos(x))) / DEGREE;
12     posangle(a) : if(-a, a + 2*PI, a) / DEGREE;
13     Atan2(y,x) : posangle(atan2(y,x));
14    
15     kqpola(r) : select(r, 9, 27, 46, 66, 90);
16     kqnaz(r) : select(r, 1, 88, 12, 12, 8);
17     kqaccum(r) : if(r-.5, kqnaz(r) + kqaccum(r-1), 0);
18     kqfindrow(r, pol) : if(r-kqpola(0)+.5, r,
19     if(pol-kqpola(r), kqfindrow(r+1, pol), r) );
20    
21     kqazn(azi,inc) : if((360-.5*inc)-azi, floor((azi+.5*inc)/inc), 0);
22    
23     kqbin2(pol,azi) = if(pol-90, -1,
24     select(kqfindrow(1, pol),
25     kqazn(azi,360/kqnaz(1)),
26     kqaccum(1) + kqazn(azi,360/kqnaz(2)),
27     kqaccum(2) + kqazn(azi,360/kqnaz(3)),
28     kqaccum(3) + kqazn(azi,360/kqnaz(4)),
29     kqaccum(4) + kqazn(azi,360/kqnaz(5))
30     ) );
31    
32     kqbin(Nx,Ny,Nz,Ux,Uy,Uz) = kqbin2(Acos(-Dx*Nx-Dy*Ny-Dz*Nz),
33     Atan2(-Dx*Ux-Dy*Uy-Dz*Uz,
34     -Dx*(Uy*Nz-Uz*Ny) - Dy*(Uz*Nx-Ux*Nz) - Dz*(Ux*Ny-Uy*Nx)));
35    
36     Nkqbins : kqaccum(kqnaz(0)); { Number of bins for one elevation }