| 24 |
|
my $doforw = 0; |
| 25 |
|
my $doback = 1; |
| 26 |
|
my $pctcull = 90; |
| 27 |
< |
my $gunit = "Meter"; |
| 27 |
> |
my $gunit = "meter"; |
| 28 |
|
my @dim; |
| 29 |
|
# Get options |
| 30 |
|
while ($#ARGV >= 0) { |
| 108 |
|
print "<!-- File produced by: genBSDF @savedARGV -->\n"; |
| 109 |
|
print |
| 110 |
|
'<WindowElementType>System</WindowElementType> |
| 111 |
+ |
<FileType>BSDF</FileType> |
| 112 |
|
<Optical> |
| 113 |
|
<Layer> |
| 114 |
|
<Material> |
| 118 |
|
printf "\t\t<Thickness unit=\"$gunit\">%.3f</Thickness>\n", $dim[5] - $dim[4]; |
| 119 |
|
printf "\t\t<Width unit=\"$gunit\">%.3f</Width>\n", $dim[1] - $dim[0]; |
| 120 |
|
printf "\t\t<Height unit=\"$gunit\">%.3f</Height>\n", $dim[3] - $dim[2]; |
| 121 |
< |
print "\t\t<DeviceType>Integral</DeviceType>\n"; |
| 121 |
> |
print "\t\t<DeviceType>Other</DeviceType>\n"; |
| 122 |
> |
print " </Material>\n"; |
| 123 |
|
# Output MGF description if requested |
| 124 |
|
if ( $geout ) { |
| 125 |
< |
print "\t\t<Geometry format=\"MGF\" unit=\"$gunit\">\n"; |
| 125 |
> |
print "\t<Geometry format=\"MGF\">\n"; |
| 126 |
> |
print "\t\t<MGFblock unit=\"$gunit\">\n"; |
| 127 |
|
printf "xf -t %.6f %.6f 0\n", -($dim[0]+$dim[1])/2, -($dim[2]+$dim[3])/2; |
| 128 |
|
open(MGFSCN, "< $mgfscn"); |
| 129 |
|
while (<MGFSCN>) { print $_; } |
| 130 |
|
close MGFSCN; |
| 131 |
|
print "xf\n"; |
| 132 |
< |
print "\t\t</Geometry>\n"; |
| 132 |
> |
print "</MGFblock>\n"; |
| 133 |
> |
print "\t</Geometry>\n"; |
| 134 |
|
} |
| 131 |
– |
print " </Material>\n"; |
| 135 |
|
# Set up surface sampling |
| 136 |
|
my $nx = int(sqrt($nsamp*($dim[1]-$dim[0])/($dim[3]-$dim[2])) + .5); |
| 137 |
|
my $ny = int($nsamp/$nx + .5); |
| 181 |
|
norm_radians(p) : if(-p - PI/4, p + 2*PI, p); |
| 182 |
|
in_disk_r = .999995*sqrt(Dx*Dx + Dy*Dy); |
| 183 |
|
in_disk_phi = norm_radians(atan2(Dy, Dx)); |
| 184 |
< |
in_disk_rgn = floor((in_disk_phi + PI/4)/(PI/2)) + 1; |
| 184 |
> |
in_disk_rgn = floor((.999995*in_disk_phi + PI/4)/(PI/2)) + 1; |
| 185 |
|
out_square_a = select(in_disk_rgn, |
| 186 |
|
in_disk_r, |
| 187 |
|
(PI/2 - in_disk_phi)*in_disk_r/(PI/4), |
| 277 |
|
q{-e '$1=(0.265*$1+0.670*$2+0.065*$3)/Omega' }; |
| 278 |
|
if ($pctcull >= 0) { |
| 279 |
|
$cmd .= "-of $td/" . ($bmodnm,$fmodnm)[$forw] . ".flt " . |
| 280 |
< |
"| rttree_reduce -a -h -ff -t $pctcull -r $tensortree -g $ttlog2"; |
| 280 |
> |
"| rttree_reduce -h -ff -t $pctcull -r $tensortree -g $ttlog2"; |
| 281 |
> |
$cmd .= " -a" if ($tensortree == 3); |
| 282 |
|
system "$cmd" || die "Failure running rttree_reduce"; |
| 283 |
|
} else { |
| 284 |
|
$cmd .= "$td/" . ($bmodnm,$fmodnm)[$forw] . ".flt"; |
| 307 |
|
print "\t\t\t<WavelengthDataDirection>Reflection $side</WavelengthDataDirection>\n"; |
| 308 |
|
print |
| 309 |
|
' <AngleBasis>LBNL/Shirley-Chiu</AngleBasis> |
| 310 |
< |
<ScatteringDataType>BRDF</ScatteringDataType> |
| 310 |
> |
<ScatteringDataType>BTDF</ScatteringDataType> |
| 311 |
|
<ScatteringData> |
| 312 |
|
'; |
| 313 |
|
$cmd = "rcalc -if3 -e 'Omega:PI/($ns*$ns)' " . |
| 408 |
|
system "$cmd" || die "Failure running: $cmd\n"; |
| 409 |
|
@tfarr = `$rccmd $td/$fmodnm.flt`; |
| 410 |
|
die "Failure running: $rccmd $td/$fmodnm.flt\n" if ( $? ); |
| 411 |
+ |
chomp(@tfarr); |
| 412 |
|
@rfarr = `$rccmd $td/$bmodnm.flt`; |
| 413 |
|
die "Failure running: $rccmd $td/$bmodnm.flt\n" if ( $? ); |
| 414 |
+ |
chomp(@rfarr); |
| 415 |
|
} |
| 416 |
|
if ( $doback ) { |
| 417 |
|
$cmd = "cnt $ndiv $ny $nx | rcalc -of -e '$tcal' " . |
| 544 |
|
<WavelengthDataDirection>Reflection Front</WavelengthDataDirection> |
| 545 |
|
<ColumnAngleBasis>LBNL/Klems Full</ColumnAngleBasis> |
| 546 |
|
<RowAngleBasis>LBNL/Klems Full</RowAngleBasis> |
| 547 |
< |
<ScatteringDataType>BRDF</ScatteringDataType> |
| 547 |
> |
<ScatteringDataType>BTDF</ScatteringDataType> |
| 548 |
|
<ScatteringData> |
| 549 |
|
'; |
| 550 |
|
# Output front reflection (transposed order) |
| 594 |
|
<WavelengthDataDirection>Reflection Back</WavelengthDataDirection> |
| 595 |
|
<ColumnAngleBasis>LBNL/Klems Full</ColumnAngleBasis> |
| 596 |
|
<RowAngleBasis>LBNL/Klems Full</RowAngleBasis> |
| 597 |
< |
<ScatteringDataType>BRDF</ScatteringDataType> |
| 597 |
> |
<ScatteringDataType>BTDF</ScatteringDataType> |
| 598 |
|
<ScatteringData> |
| 599 |
|
'; |
| 600 |
|
# Output back reflection (transposed order) |