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.8 by greg, Sat Jan 29 16:44:01 2011 UTC

# Line 31 | Line 31 | while ($#ARGV >= 0) {
31                  shift @ARGV;
32          } elsif ("$ARGV[0]" =~ /^-d/) {
33                  userror() if ($#ARGV < 6);
34 <                @dim = "@ARGV[1..6]";
34 >                @dim = @ARGV[1..6];
35                  shift @ARGV for (1..6);
36          } elsif ("$ARGV[0]" =~ /^[-+]./) {
37                  userror();
# Line 54 | Line 54 | if ( $mgfin ) {
54          system "rad2mgf $radscn > $mgfscn" if ( $geout );
55   }
56   if ($#dim != 5) {
57 <        @dim = split /\s+/, `getbbox -h $radscn`;
58 <        shift @dim;
57 >        @dim = split ' ', `getbbox -h $radscn`;
58   }
59   print STDERR "Warning: Device extends into room\n" if ($dim[5] > 1e-5);
60   # Add receiver surface (rectangle)
# Line 75 | Line 74 | die "Could not compile scene\n" if ( $? );
74   # Kbin to produce incident direction in full Klems basis with (x1,x2) randoms
75   my $tcal = '
76   DEGREE : PI/180;
77 + sq(x) : x*x;
78   Kpola(r) : select(r+1, -5, 5, 15, 25, 35, 45, 55, 65, 75, 90);
79   Knaz(r) : select(r, 1, 8, 16, 20, 24, 24, 24, 16, 12);
80   Kaccum(r) : if(r-.5, Knaz(r) + Kaccum(r-1), 0);
# Line 88 | Line 88 | sin_kpol = sin(Kpol);
88   Dx = -cos(Kazi)*sin_kpol;
89   Dy = sin(Kazi)*sin_kpol;
90   Dz = sqrt(1 - sin_kpol*sin_kpol);
91 < Komega = 2*PI*if(Kbin-.5,
92 <        (cos(Kpola(Krow-1)*DEGREE) - cos(Kpola(Krow)*DEGREE))/Knaz(Krow),
93 <        1 - cos(Kpola(1)*DEGREE));
91 > KprojOmega = PI * if(Kbin-.5,
92 >        (sq(cos(Kpola(Krow-1)*DEGREE)) - sq(cos(Kpola(Krow)*DEGREE)))/Knaz(Krow),
93 >        1 - sq(cos(Kpola(1)*DEGREE)));
94   ';
95   # Compute Klems bin from exiting ray direction
96   my $kcal = '
# Line 130 | Line 130 | my $cmd = "cnt $ndiv $ny $nx | rcalc -of -e '$tcal' "
130          q{-e '$1=xp;$2=yp;$3=zp;$4=Dx;$5=Dy;$6=Dz' } .
131          "| rtcontrib -h -ff -n $nproc -c $nsamp -e '$kcal' -b kbin -bn $ndiv " .
132          "-m $modnm -w -ab 5 -ad 700 -lw 3e-6 $octree " .
133 <        "| rcalc -e 'x1:.5;x2:.5;$tcal' " .
134 <        "-e 'mod(n,d):n-floor(n/d)*d' -e 'Kbin=mod(recno-1,$ndiv)' " .
135 <        q{-if3 -e '$1=(0.265*$1+0.670*$2+0.065*$3)/(Komega*Dz)'};
133 >        "| rcalc -e '$tcal' " .
134 >        "-e 'mod(n,d):n-floor(n/d)*d' -e 'Kbin=mod(recno-.999,$ndiv)' " .
135 >        q{-if3 -e '$1=(0.265*$1+0.670*$2+0.065*$3)/KprojOmega'};
136   my @darr = `$cmd`;
137   die "Failure running: $cmd\n" if ( $? );
138   # Output XML prologue

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines