$| = 1; # flush buffers after every write
-$do_demfit = 1;
-$do_triangle_1 = 1;
-$do_fixnode = 1;
-$do_splittris = 1;
-$do_assemtris = 1;
-$do_triangle_2 = 1;
-
-$do_tri2obj = 1;
-$do_strips = 1;
+$do_dem2node = 0;
+$do_triangle_1 = 0;
+$do_fixnode = 0;
+$do_splittris = 0;
+$do_assemtris = 0;
+$do_triangle_2 = 0;
+
+$do_tri2obj = 0;
+$do_strips = 0;
$do_fixobj = 1;
# set the FG_ROOT environment variable if it hasn't already been set.
if ( $ENV{FG_ROOT} eq "" ) {
# look for a file called fgtop as a place marker
- if ( -e "fgtop" ) {
- $ENV{FG_ROOT} = ".";
- } elsif ( -e "../fgtop" ) {
- $ENV{FG_ROOT} = "..";
- }
+ die "You must remember to set the FG_ROOT environment variable!\n";
}
}
- if ( $do_demfit ) {
- demfit() ;
+ if ( $do_dem2node ) {
+ dem2node() ;
} else {
- $subdir = "../Scenery/w100n040/w093n045";
+ $subdir = "../Scenery/w120n030/w111n033";
print "WARNING: Hardcoding subdir = $subdir\n";
}
exit(0);
+# fix command to work with windoze, replaces first "/" with "\\"
+sub fix_command {
+ my($in) = @_;
+
+ $system = `uname -s`;
+ chop($system);
+
+ if ( $system =~ m/CYGWIN32/ ) {
+ $in =~ s/\//\\\\/;
+ }
+
+ return($in);
+}
+
+
# return the file name root (ending at last ".")
sub file_root {
my($file) = @_;
# splits dem file into 64 file.node's which contain the
# irregularly fitted vertices
-sub demfit {
- if ( $dem_file =~ m/.gz$/ ) {
- $command = "gzip -dc $dem_file | ./Dem2node/dem2node $ENV{FG_ROOT} - $error";
- } else {
- $command = "./Dem2node/dem2node $ENV{FG_ROOT} $dem_file $error";
- }
-
+sub dem2node {
+ $command = "Dem2node/dem2node $ENV{FG_ROOT} $dem_file $error";
+ $command = fix_command($command);
print "Running '$command'\n";
open(OUT, "$command |");
print $file;
chop($file);
if ( ($file =~ m/\.node$/) && ($file !~ m/\.\d\.node$/) ) {
- $command = "./Triangle/triangle -q $subdir/$file";
+ $command = "Triangle/triangle -q $subdir/$file";
+ $command = fix_command($command);
print "Running '$command'\n";
open(OUT, "$command |");
while ( <OUT> ) {
# fixed file.1.node
sub fixnode {
- if ( $dem_file =~ m/.gz$/ ) {
- $command = "gzip -dc $dem_file | ./FixNode/fixnode - $subdir";
- } else {
- $command = "./FixNode/fixnode $dem_file $subdir";
- }
+ $command = "FixNode/fixnode $dem_file $subdir";
+ $command = fix_command($command);
print "Running '$command'\n";
open(OUT, "$command |");
while ( <OUT> ) {
if ( $file =~ m/\.1\.node$/ ) {
$file =~ s/\.node$//; # strip off the ".node"
- $command = "./SplitTris/splittris $subdir/$file";
+ $command = "SplitTris/splittris $subdir/$file";
+ $command = fix_command($command);
print "Running '$command'\n";
open(OUT, "$command |");
while ( <OUT> ) {
if ( $file =~ m/\.1\.body$/ ) {
$file =~ s/\.body$//; # strip off the ".body"
- $command = "./AssemTris/assemtris $subdir/$file";
+ $command = "AssemTris/assemtris $subdir/$file";
+ $command = fix_command($command);
print "Running '$command'\n";
open(OUT, "$command |");
while ( <OUT> ) {
print $file;
chop($file);
if ( ($file =~ m/\.node$/) && ($file !~ m/\.\d\.node$/) ) {
- $command = "./Triangle/triangle $subdir/$file";
+ $base = $file;
+ $base =~ s/\.node$//;
+ print("Test for $subdir/$base.q\n");
+ if ( -r "$subdir/$base.q" ) {
+
+ # if triangle hangs, we can create a filebase.q for
+ # the file it hung on. Then, we test for that file
+ # here which causes the incremental algorithm to run
+ # (which shouldn't ever hang.)
+
+ $command = "Triangle/triangle -i $subdir/$file";
+ } else {
+ $command = "Triangle/triangle $subdir/$file";
+ }
+ $command = fix_command($command);
print "Running '$command'\n";
open(OUT, "$command |");
while ( <OUT> ) {
if ( $file =~ m/\.1\.node$/ ) {
$file =~ s/\.node$//; # strip off the ".node"
- $command = "./Tri2obj/tri2obj $subdir/$file";
+ $command = "Tri2obj/tri2obj $subdir/$file";
+ $command = fix_command($command);
print "Running '$command'\n";
open(OUT, "$command |");
while ( <OUT> ) {
foreach $file ( @FILES ) {
chop($file);
if ( $file =~ m/\.1\.obj$/ ) {
- $command = "./Stripe_u/strips $subdir/$file";
+ $command = "Stripe_u/strips $subdir/$file";
+ $command = fix_command($command);
print "Running '$command'\n";
open(OUT, "$command |");
while ( <OUT> ) {
$newfile = $file;
$newfile =~ s/\.2\.obj$/.obj/;
- $command = "./FixObj/fixobj $subdir/$file $subdir/$newfile";
+ $command = "FixObj/fixobj $subdir/$file $subdir/$newfile";
+ $command = fix_command($command);
print "Running '$command'\n";
open(OUT, "$command |");
while ( <OUT> ) {
}
close(OUT);
- unlink("$subdir/$file");
+ # unlink("$subdir/$file");
}
}
}
#---------------------------------------------------------------------------
# $Log$
+# Revision 1.18 1998/05/20 20:55:40 curt
+# Makefile tweaks
+#
+# Revision 1.17 1998/04/28 01:23:25 curt
+# Added a work around so that we can get past the "triangle" program
+# hanging, by aborting and rerunning with that tile marked to use the "-i"
+# option.
+#
+# Revision 1.16 1998/04/18 03:57:53 curt
+# Added zlib library support.
+#
+# Revision 1.15 1998/04/08 23:24:07 curt
+# Adopted Gnu automake/autoconf system.
+#
+# Revision 1.14 1998/04/06 21:09:38 curt
+# Additional win32 support.
+# Fixed a bad bug in dem file parsing that was causing the output to be
+# flipped about x = y.
+#
# Revision 1.13 1998/03/19 02:52:52 curt
# Updated to reflect some minor tool reorganization and the creation of class
# to handle DEM processing needs.