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.28 by greg, Mon Nov 21 20:07:50 2011 UTC vs.
Revision 2.31 by greg, Mon Feb 20 04:54:49 2012 UTC

# Line 8 | Line 8
8   use strict;
9   use File::Temp qw/ :mktemp  /;
10   sub userror {
11 <        print STDERR "Usage: genBSDF [-n Nproc][-c Nsamp][-t{3|4} Nlog2][-r \"ropts\"][-dim xmin xmax ymin ymax zmin zmax][{+|-}f][{+|-}b][{+|-}mgf][{+|-}geom] [input ..]\n";
11 >        print STDERR "Usage: genBSDF [-n Nproc][-c Nsamp][-t{3|4} Nlog2][-r \"ropts\"][-dim xmin xmax ymin ymax zmin zmax][{+|-}f][{+|-}b][{+|-}mgf][{+|-}geom units] [input ..]\n";
12          exit 1;
13   }
14   my $td = mkdtemp("/tmp/genBSDF.XXXXXX");
# Line 403 | Line 403 | KprojOmega = PI * if(Kbin-.5,
403   $kcal = '
404   DEGREE : PI/180;
405   abs(x) : if(x, x, -x);
406 < Acos(x) : 1/DEGREE * if(x-1, 0, if(-1-x, 0, acos(x)));
406 > Acos(x) : if(x-1, 0, if(-1-x, PI, acos(x))) / DEGREE;
407   posangle(a) : if(-a, a + 2*PI, a);
408 < Atan2(y,x) : 1/DEGREE * posangle(atan2(y,x));
408 > Atan2(y,x) : posangle(atan2(y,x)) / DEGREE;
409   kpola(r) : select(r, 5, 15, 25, 35, 45, 55, 65, 75, 90);
410   knaz(r) : select(r, 1, 8, 16, 20, 24, 24, 24, 16, 12);
411   kaccum(r) : if(r-.5, knaz(r) + kaccum(r-1), 0);
# Line 437 | Line 437 | my $rtcmd = "rtcontrib $rtargs -h -ff -fo -n $nproc -c
437          "-o '$td/%s.flt' -m $fmodnm -m $bmodnm $octree";
438   my $rccmd = "rcalc -e '$tcal' " .
439          "-e 'mod(n,d):n-floor(n/d)*d' -e 'Kbin=mod(recno-.999,$ndiv)' " .
440 <        q{-if3 -e 'oval=(0.265*$1+0.670*$2+0.065*$3)/KprojOmega' } .
441 <        q[-o '${  oval  },'];
440 >        q{-if3 -e '$1=(0.265*$1+0.670*$2+0.065*$3)/KprojOmega' };
441   if ( $doforw ) {
442   $cmd = "cnt $ndiv $ny $nx | rcalc -of -e '$tcal' " .
443          "-e 'xp=(\$3+rand(.12*recno+288))*(($dim[1]-$dim[0])/$nx)+$dim[0]' " .
# Line 565 | Line 564 | print
564   # Output front transmission (transposed order)
565   for (my $od = 0; $od < $ndiv; $od++) {
566          for (my $id = 0; $id < $ndiv; $id++) {
567 <                print $tfarr[$ndiv*$id + $od];
567 >                print $tfarr[$ndiv*$id + $od], ",\n";
568          }
569          print "\n";
570   }
# Line 585 | Line 584 | print
584                          <ScatteringDataType>BRDF</ScatteringDataType>
585                          <ScatteringData>
586   ';
587 < # Output front reflection (reciprocity averaging)
587 > # Output front reflection (transposed order)
588   for (my $od = 0; $od < $ndiv; $od++) {
589          for (my $id = 0; $id < $ndiv; $id++) {
590 <                print .5*($rfarr[$ndiv*$id + $od] + $rfarr[$ndiv*$od + $id]);
590 >                print $rfarr[$ndiv*$id + $od], ",\n";
591          }
592          print "\n";
593   }
# Line 615 | Line 614 | print
614   # Output back transmission (transposed order)
615   for (my $od = 0; $od < $ndiv; $od++) {
616          for (my $id = 0; $id < $ndiv; $id++) {
617 <                print $tbarr[$ndiv*$id + $od];
617 >                print $tbarr[$ndiv*$id + $od], ",\n";
618          }
619          print "\n";
620   }
# Line 638 | Line 637 | print
637   # Output back reflection (reciprocity averaging)
638   for (my $od = 0; $od < $ndiv; $od++) {
639          for (my $id = 0; $id < $ndiv; $id++) {
640 <                print .5*($rbarr[$ndiv*$id + $od] + $rbarr[$ndiv*$od + $id]);
640 >                print $rbarr[$ndiv*$id + $od], ",\n";
641          }
642          print "\n";
643   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines