ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cv/bsdf2rad.cal
Revision: 2.4
Committed: Tue Apr 11 02:21:37 2017 UTC (7 years, 1 month ago) by greg
Branch: MAIN
Changes since 2.3: +7 -2 lines
Log Message:
Fixed issue with up vector that was misorienting 3-D plots

File Contents

# User Rev Content
1 greg 2.4 { RCSid $Id: bsdf2rad.cal,v 2.3 2017/04/10 15:44:20 greg Exp $ }
2 greg 2.1 {
3     Calculation of false color scale for bsdf2rad.
4    
5     Greg Ward April 2017
6     }
7     { Compute lines of latitude and longitude }
8     LATSTEP : 15*DEGREE;
9 greg 2.2 LONGSTEP : 30*DEGREE; { must divide evenly into 90 degrees }
10     LATWIDTH : 0.7*DEGREE;
11     LONGWIDTH : 1.*DEGREE;
12    
13     mylong = atan2(Ny,Nx);
14    
15 greg 2.4 latlong = if(LATWIDTH-mod(Acos(Nz)+LATWIDTH/2,LATSTEP), .05,
16 greg 2.2 if(LONGWIDTH-mod(mylong+LONGWIDTH/2,90*DEGREE), .01,
17 greg 2.3 if(LONGWIDTH-mod(mylong+LONGWIDTH/2,LONGSTEP), .3, 1)));
18 greg 2.1
19 greg 2.4 { Compute up vector corresponding to sphere position }
20     upx = Nx*Ny*(Nz-1);
21     upy = Nx*Nx + Ny*Ny*Nz;
22     upz = -Ny*(Nx*Nx+Ny*Ny);
23    
24 greg 2.1 interp_arr2`(i,x,f):(i+1-x)*f(i)+(x-i)*f(i+1);
25     interp_arr`(x,f):if(x-1,if(f(0)-x,interp_arr2(floor(x),x,f),f(f(0))),f(1));
26    
27     def_redp(i):select(i,0.18848,0.05468174,
28     0.00103547,8.311144e-08,7.449763e-06,0.0004390987,0.001367254,
29     0.003076,0.01376382,0.06170773,0.1739422,0.2881156,0.3299725,
30     0.3552663,0.372552,0.3921184,0.4363976,0.6102754,0.7757267,
31     0.9087369,1,1,0.9863);
32     sca_red(x):interp_arr(x/0.0454545+1,def_redp);
33    
34     def_grnp(i):select(i,0.0009766,2.35501e-05,
35     0.0008966244,0.0264977,0.1256843,0.2865799,0.4247083,0.4739468,
36     0.4402732,0.3671876,0.2629843,0.1725325,0.1206819,0.07316644,
37     0.03761026,0.01612362,0.004773749,6.830967e-06,0.00803605,
38     0.1008085,0.3106831,0.6447838,0.9707);
39     sca_grn(x):interp_arr(x/0.0454545+1,def_grnp);
40    
41     def_blup(i):select(i,0.2666,0.3638662,0.4770437,
42     0.5131397,0.5363797,0.5193677,0.4085123,0.1702815,0.05314236,
43     0.05194055,0.08564082,0.09881395,0.08324373,0.06072902,
44     0.0391076,0.02315354,0.01284458,0.005184709,0.001691774,
45     2.432735e-05,1.212949e-05,0.006659406,0.02539);
46     sca_blu(x):interp_arr(x/0.0454545+1,def_blup);
47    
48     { BSDF scale is based on distance from the origin }
49    
50     dist_orig = sqrt(Px*Px + Py*Py + Pz*Pz);
51     bsdf_red = sca_red(dist_orig);
52     bsdf_grn = sca_grn(dist_orig);
53     bsdf_blu = sca_blu(dist_orig);