--- ray/src/util/genBSDF.pl 2011/06/08 23:16:47 2.21 +++ ray/src/util/genBSDF.pl 2011/06/24 00:41:51 2.22 @@ -1,5 +1,5 @@ #!/usr/bin/perl -w -# RCSid $Id: genBSDF.pl,v 2.21 2011/06/08 23:16:47 greg Exp $ +# RCSid $Id: genBSDF.pl,v 2.22 2011/06/24 00:41:51 greg Exp $ # # Compute BSDF based on geometry and material description # @@ -23,6 +23,7 @@ my $geout = 1; my $nproc = 1; my $doforw = 0; my $doback = 1; +my $gunit = "Meter"; my @dim; # Get options while ($#ARGV >= 0) { @@ -33,6 +34,11 @@ while ($#ARGV >= 0) { shift @ARGV; } elsif ("$ARGV[0]" =~ /^[-+]g/) { $geout = ("$ARGV[0]" =~ /^\+/); + $gunit = $ARGV[1]; + if ($gunit !~ /^(?i)(meter|foot|inch|centimeter|millimeter)$/) { + die "Illegal geometry unit '$gunit': must be meter, foot, inch, centimeter, or millimeter\n"; + } + shift @ARGV; } elsif ("$ARGV[0]" =~ /^[-+]f/) { $doforw = ("$ARGV[0]" =~ /^\+/); } elsif ("$ARGV[0]" =~ /^[-+]b/) { @@ -109,13 +115,13 @@ print Name Manufacturer '; -printf "\t\t%.3f\n", $dim[5] - $dim[4]; -printf "\t\t%.3f\n", $dim[1] - $dim[0]; -printf "\t\t%.3f\n", $dim[3] - $dim[2]; +printf "\t\t%.3f\n", $dim[5] - $dim[4]; +printf "\t\t%.3f\n", $dim[1] - $dim[0]; +printf "\t\t%.3f\n", $dim[3] - $dim[2]; print "\t\tIntegral\n"; # Output MGF description if requested if ( $geout ) { - print "\t\t\n"; + print "\t\t\n"; printf "xf -t %.6f %.6f 0\n", -($dim[0]+$dim[1])/2, -($dim[2]+$dim[3])/2; open(MGFSCN, "< $mgfscn"); while () { print $_; }