ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/genBSDF.pl
(Generate patch)

Comparing ray/src/util/genBSDF.pl (file contents):
Revision 2.4 by greg, Thu Dec 9 06:14:04 2010 UTC vs.
Revision 2.5 by greg, Thu Dec 9 17:00:43 2010 UTC

# Line 75 | Line 75 | die "Could not compile scene\n" if ( $? );
75   # Kbin to produce incident direction in full Klems basis with (x1,x2) randoms
76   my $tcal = '
77   DEGREE : PI/180;
78 + sq(x) : x*x;
79   Kpola(r) : select(r+1, -5, 5, 15, 25, 35, 45, 55, 65, 75, 90);
80   Knaz(r) : select(r, 1, 8, 16, 20, 24, 24, 24, 16, 12);
81   Kaccum(r) : if(r-.5, Knaz(r) + Kaccum(r-1), 0);
# Line 88 | Line 89 | sin_kpol = sin(Kpol);
89   Dx = -cos(Kazi)*sin_kpol;
90   Dy = sin(Kazi)*sin_kpol;
91   Dz = sqrt(1 - sin_kpol*sin_kpol);
92 < Komega = 2*PI*if(Kbin-.5,
93 <        (cos(Kpola(Krow-1)*DEGREE) - cos(Kpola(Krow)*DEGREE))/Knaz(Krow),
94 <        1 - cos(Kpola(1)*DEGREE));
92 > KprojOmega = PI * if(Kbin-.5,
93 >        (sq(cos(Kpola(Krow-1)*DEGREE)) - sq(cos(Kpola(Krow)*DEGREE)))/Knaz(Krow),
94 >        1 - sq(cos(Kpola(1)*DEGREE)));
95   ';
96   # Compute Klems bin from exiting ray direction
97   my $kcal = '
# Line 130 | Line 131 | my $cmd = "cnt $ndiv $ny $nx | rcalc -of -e '$tcal' "
131          q{-e '$1=xp;$2=yp;$3=zp;$4=Dx;$5=Dy;$6=Dz' } .
132          "| rtcontrib -h -ff -n $nproc -c $nsamp -e '$kcal' -b kbin -bn $ndiv " .
133          "-m $modnm -w -ab 5 -ad 700 -lw 3e-6 $octree " .
134 <        "| rcalc -e 'x1:.5;x2:.5;$tcal' " .
134 >        "| rcalc -e '$tcal' " .
135          "-e 'mod(n,d):n-floor(n/d)*d' -e 'Kbin=mod(recno-1,$ndiv)' " .
136 <        q{-if3 -e '$1=(0.265*$1+0.670*$2+0.065*$3)/(Komega*Dz)'};
136 >        q{-if3 -e '$1=(0.265*$1+0.670*$2+0.065*$3)/KprojOmega'};
137   my @darr = `$cmd`;
138   die "Failure running: $cmd\n" if ( $? );
139   # Output XML prologue

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines