--- a/bin/ltpict.pl Tue Apr 08 22:56:34 2014 +0100
+++ b/bin/ltpict.pl Mon Apr 14 22:18:50 2014 +0100
@@ -47,18 +47,21 @@
shift @ARGV;
}
-if ($is_ies == 0) {
+# We need exactly one Radiance luminaires or IES file
+if (! $#ARGV == 0) {
+ die("ltpict: Need one Radiance luminaire or IES file.\n");
+} elsif ($is_ies == 0) {
# Input file is a Radiance luminaire
$lumi = $ARGV[0];
} else {
# Input file is IES photometry
- system "ies2rad -p $td -o lumi $ARGV[0]";
+ system qq[ ies2rad -p $td -o lumi "$ARGV[0]" ];
}
my $res2 = $res / 2; # Each rendering is half the size of final composite
# Scale luminaire and center at origin
-my $dimstr = `getbbox -h $lumi`;
+my $dimstr = `getbbox -h "$lumi"`;
chomp $dimstr;
# Values returned by getbbox are indented and delimited with multiple spaces.
$dimstr =~ s/^\s+//; # remove leading spaces
@@ -74,11 +77,7 @@
my $ytrans = -1.0 * ($dims[2] + $dims[3]) / 2;
my $ztrans = -1.0 * ($dims[4] + $dims[5]) / 2;
my $scale = $maxsize / $size;
-
-open(FH, ">$lumi2") or
- die("ltpict: Cannot write to temporary file $lumi");
-print FH "!xform -t $xtrans $ytrans $ztrans -s $scale $lumi";
-close FH;
+system qq[ xform -t $xtrans $ytrans $ztrans "$lumi" > $lumi2 ];
# Material for the room
@@ -123,6 +122,7 @@
$dimstr =~ s/^\s+//; # remove leading spaces
@dims = split(/\s+/, $dimstr); # convert to array
+
# Define the four views
my $vw1 = "-vtl -vp 4.5 0 0 -vd -1 0 0 -vh 10 -vv 10";
my $vw2 = "-vtl -vp 0 -4.5 0 -vd 0 1 0 -vh 10 -vv 10";
@@ -131,6 +131,8 @@
my $zcent4 = $dims[5] + $tiny;
my $vw4 = "-vta -vp 0 0 $zcent4 -vd 0 0 1 -vu 0 1 0 -vh 180 -vv 180";
+
+# Compile octrees
system "oconv $mat $room1 $lumi2 > $oct1";
system "oconv $mat $room2 $lumi2 > $oct2";
system "oconv $mat $room3 $lumi2 > $oct3";