1 // dem.cxx -- DEM management class
3 // Written by Curtis Olson, started March 1998.
5 // Copyright (C) 1998 Curtis L. Olson - curt@flightgear.org
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 // (Log is kept at end of this file)
29 #include <Include/compiler.h>
31 #include <ctype.h> // isspace()
32 #include <stdlib.h> // atoi()
33 #include <math.h> // rint()
37 #ifdef HAVE_SYS_STAT_H
38 # include <sys/stat.h> // stat()
41 #ifdef FG_HAVE_STD_INCLUDES
48 # include <unistd.h> // stat()
51 #include <Misc/fgstream.hxx>
52 #include <Misc/strutils.hxx>
53 #include <Include/fg_constants.h>
58 #define MAX_EX_NODES 10000
64 # define MKDIR(a) mkdir(a)
66 # define MKDIR(a) mkdir(a,S_IRWXU) // I am just guessing at this flag (NHV)
67 # endif // __BORLANDC__
72 FGDem::FGDem( void ) {
73 // cout << "class FGDem CONstructor called." << endl;
74 dem_data = new float[DEM_SIZE_1][DEM_SIZE_1];
75 output_data = new float[DEM_SIZE_1][DEM_SIZE_1];
79 FGDem::FGDem( const string &file ) {
80 // cout << "class FGDem CONstructor called." << endl;
81 dem_data = new float[DEM_SIZE_1][DEM_SIZE_1];
82 output_data = new float[DEM_SIZE_1][DEM_SIZE_1];
90 FGDem::open ( const string& file ) {
91 // open input file (or read from stdin)
93 printf("Loading DEM data file: stdin\n");
95 // fd = gzdopen(STDIN_FILENO, "r");
96 printf("Not yet ported ...\n");
99 in = new fg_gzifstream( file );
101 cout << "Cannot open " << file << endl;
104 cout << "Loading DEM data file: " << file << endl;
114 // the fg_gzifstream doesn't seem to have a close()
122 // return next token from input stream
124 FGDem::next_token() {
129 // cout << " returning " + token + "\n";
135 // return next integer from input stream
146 // return next double from input stream
148 FGDem::next_double() {
157 // return next exponential num from input stream
162 token = next_token();
164 const char* p = token.c_str();
168 for ( ; *p != 0; ++p )
176 return ::atof( buf );
180 // read and parse DEM "A" record
182 FGDem::read_a_record() {
188 // get the name field (144 characters)
189 for ( i = 0; i < 144; i++ ) {
194 // clean off the trailing whitespace
196 cout << " Quad name field: " << name << endl;
198 // DEM level code, 3 reflects processing by DMA
200 cout << " DEM level code = " << inum << "\n";
206 // Pattern code, 1 indicates a regular elevation pattern
208 cout << " Pattern code = " << inum << "\n";
210 // Planimetric reference system code, 0 indicates geographic
211 // coordinate system.
213 cout << " Planimetric reference code = " << inum << "\n";
217 cout << " Zone code = " << inum << "\n";
219 // Map projection parameters (ignored)
220 for ( i = 0; i < 15; i++ ) {
222 // printf("%d: %f\n",i,dnum);
225 // Units code, 3 represents arc-seconds as the unit of measure for
226 // ground planimetric coordinates throughout the file.
229 cout << " Unknown (X,Y) units code = " << inum << "!\n";
233 // Units code; 2 represents meters as the unit of measure for
234 // elevation coordinates throughout the file.
237 cout << " Unknown (Z) units code = " << inum << "!\n";
241 // Number (n) of sides in the polygon which defines the coverage of
242 // the DEM file (usually equal to 4).
245 cout << " Unknown polygon dimension = " << inum << "!\n";
249 // Ground coordinates of bounding box in arc-seconds
250 dem_x1 = originx = next_exp();
251 dem_y1 = originy = next_exp();
252 cout << " Origin = (" << originx << "," << originy << ")\n";
263 // Minimum/maximum elevations in meters
266 cout << " Elevation range " << dem_z1 << " to " << dem_z2 << "\n";
268 // Counterclockwise angle from the primary axis of ground
269 // planimetric referenced to the primary axis of the DEM local
271 token = next_token();
273 // Accuracy code; 0 indicates that a record of accuracy does not
274 // exist and that no record type C will follow.
276 // DEM spacial resolution. Usually (3,3,1) (3,6,1) or (3,9,1)
277 // depending on latitude
279 // I will eventually have to do something with this for data at
280 // higher latitudes */
281 token = next_token();
282 cout << " accuracy & spacial resolution string = " << token << endl;
284 cout << " length = " << i << "\n";
286 inum = atoi( token.substr( 0, i - 36 ) );
287 row_step = atof( token.substr( i - 24, 12 ) );
288 col_step = atof( token.substr( i - 36, 12 ) );
289 cout << " Accuracy code = " << inum << "\n";
290 cout << " column step = " << col_step <<
291 " row step = " << row_step << "\n";
293 // dimension of arrays to follow (1)
294 token = next_token();
296 // number of profiles
297 dem_num_profiles = cols = next_int();
298 cout << " Expecting " << dem_num_profiles << " profiles\n";
304 // read and parse DEM "B" record
306 FGDem::read_b_record( ) {
310 // row / column id of this profile
311 prof_row = next_int();
312 prof_col = next_int();
313 // printf("col id = %d row id = %d\n", prof_col, prof_row);
315 // Number of columns and rows (elevations) in this profile
316 prof_num_rows = rows = next_int();
317 prof_num_cols = next_int();
318 // printf(" profile num rows = %d\n", prof_num_rows);
320 // Ground planimetric coordinates (arc-seconds) of the first
321 // elevation in the profile
322 prof_x1 = next_exp();
323 prof_y1 = next_exp();
324 // printf(" Starting at %.2f %.2f\n", prof_x1, prof_y1);
326 // Elevation of local datum for the profile. Always zero for
327 // 1-degree DEM, the reference is mean sea level.
328 token = next_token();
330 // Minimum and maximum elevations for the profile.
331 token = next_token();
332 token = next_token();
334 // One (usually) dimensional array (prof_num_cols,1) of elevations
335 for ( i = 0; i < prof_num_rows; i++ ) {
336 prof_data = next_int();
337 dem_data[cur_col][i] = (float)prof_data;
349 if ( !read_a_record() ) {
353 for ( i = 0; i < dem_num_profiles; i++ ) {
354 // printf("Ready to read next b record\n");
358 if ( cur_col % 100 == 0 ) {
359 cout << " loaded " << cur_col << " profiles of data\n";
363 cout << " Done parsing\n";
369 // write out the area of data covered by the specified bucket. Data
370 // is written out column by column starting at the lower left hand
373 FGDem::write_area( const string& root, FGBucket& b, bool compress ) {
374 // calculate some boundaries
375 double min_x = ( b.get_center_lon() - 0.5 * b.get_width() ) * 3600.0;
376 double max_x = ( b.get_center_lon() + 0.5 * b.get_width() ) * 3600.0;
378 double min_y = ( b.get_center_lat() - 0.5 * b.get_height() ) * 3600.0;
379 double max_y = ( b.get_center_lat() + 0.5 * b.get_height() ) * 3600.0;
382 cout << "width = " << b.get_width() << " height = " << b.get_height()
385 int start_x = (int)((min_x - originx) / col_step);
386 int span_x = (int)(b.get_width() * 3600.0 / col_step);
388 int start_y = (int)((min_y - originy) / row_step);
389 int span_y = (int)(b.get_height() * 3600.0 / row_step);
391 cout << "start_x = " << start_x << " span_x = " << span_x << endl;
392 cout << "start_y = " << start_y << " span_y = " << span_y << endl;
394 // Do a simple sanity checking. But, please, please be nice to
395 // this write_area() routine and feed it buckets that coincide
396 // well with the underlying grid structure and spacing.
398 if ( ( min_x < originx )
399 || ( max_x > originx + cols * col_step )
400 || ( min_y < originy )
401 || ( max_y > originy + rows * row_step ) ) {
402 cout << " ERROR: bucket at least partially outside DEM data range!" <<
407 // generate output file name
408 string base = b.gen_base_path();
409 string path = root + "/Scenery/" + base;
410 string command = "mkdir -p " + path;
411 system( command.c_str() );
413 string demfile = path + "/" + b.gen_index_str() + ".dem";
414 cout << "demfile = " << demfile << endl;
418 if ( (fp = fopen(demfile.c_str(), "w")) == NULL ) {
419 cout << "cannot open " << demfile << " for writing!" << endl;
423 fprintf( fp, "%d %d\n", (int)min_x, (int)min_y );
424 fprintf( fp, "%d %d %d %d\n", span_x + 1, (int)col_step,
425 span_y + 1, (int)row_step );
426 for ( int i = start_x; i <= start_x + span_x; ++i ) {
427 for ( int j = start_y; j <= start_y + span_y; ++j ) {
428 fprintf( fp, "%d ", (int)dem_data[i][j] );
435 string command = "gzip --best -f " + demfile;
436 system( command.c_str() );
445 // return the current altitude based on grid data. We should rewrite
446 // this to interpolate exact values, but for now this is good enough
447 double FGDem::interpolate_altitude( double lon, double lat ) {
448 // we expect incoming (lon,lat) to be in arcsec for now
450 double xlocal, ylocal, dx, dy, zA, zB, elev;
451 int x1, x2, x3, y1, y2, y3;
455 /* determine if we are in the lower triangle or the upper triangle
463 then calculate our end points
466 xlocal = (lon - originx) / col_step;
467 ylocal = (lat - originy) / row_step;
469 xindex = (int)(xlocal);
470 yindex = (int)(ylocal);
472 // printf("xindex = %d yindex = %d\n", xindex, yindex);
474 if ( xindex + 1 == cols ) {
478 if ( yindex + 1 == rows ) {
482 if ( (xindex < 0) || (xindex + 1 >= cols) ||
483 (yindex < 0) || (yindex + 1 >= rows) ) {
487 dx = xlocal - xindex;
488 dy = ylocal - yindex;
492 // printf(" Lower triangle\n");
496 z1 = dem_data[x1][y1];
500 z2 = dem_data[x2][y2];
504 z3 = dem_data[x3][y3];
506 // printf(" dx = %.2f dy = %.2f\n", dx, dy);
507 // printf(" (x1,y1,z1) = (%d,%d,%d)\n", x1, y1, z1);
508 // printf(" (x2,y2,z2) = (%d,%d,%d)\n", x2, y2, z2);
509 // printf(" (x3,y3,z3) = (%d,%d,%d)\n", x3, y3, z3);
511 zA = dx * (z2 - z1) + z1;
512 zB = dx * (z3 - z1) + z1;
514 // printf(" zA = %.2f zB = %.2f\n", zA, zB);
516 if ( dx > FG_EPSILON ) {
517 elev = dy * (zB - zA) / dx + zA;
523 // printf(" Upper triangle\n");
527 z1 = dem_data[x1][y1];
531 z2 = dem_data[x2][y2];
535 z3 = dem_data[x3][y3];
537 // printf(" dx = %.2f dy = %.2f\n", dx, dy);
538 // printf(" (x1,y1,z1) = (%d,%d,%d)\n", x1, y1, z1);
539 // printf(" (x2,y2,z2) = (%d,%d,%d)\n", x2, y2, z2);
540 // printf(" (x3,y3,z3) = (%d,%d,%d)\n", x3, y3, z3);
542 zA = dy * (z2 - z1) + z1;
543 zB = dy * (z3 - z1) + z1;
545 // printf(" zA = %.2f zB = %.2f\n", zA, zB );
546 // printf(" xB - xA = %.2f\n", col_step * dy / row_step);
548 if ( dy > FG_EPSILON ) {
549 elev = dx * (zB - zA) / dy + zA;
559 // Use least squares to fit a simpler data set to dem data
560 void FGDem::fit( double error, FGBucket& p ) {
561 double x[DEM_SIZE_1], y[DEM_SIZE_1];
562 double m, b, ave_error, max_error;
564 int n, row, start, end;
565 int colmin, colmax, rowmin, rowmax;
567 // FILE *dem, *fit, *fit1;
569 printf("Initializing output mesh structure\n");
572 // determine dimensions
573 colmin = p.get_x() * ( (cols - 1) / 8);
574 colmax = colmin + ( (cols - 1) / 8);
575 rowmin = p.get_y() * ( (rows - 1) / 8);
576 rowmax = rowmin + ( (rows - 1) / 8);
577 printf("Fitting region = %d,%d to %d,%d\n", colmin, rowmin, colmax, rowmax);
579 // include the corners explicitly
580 outputmesh_set_pt(colmin, rowmin, dem_data[colmin][rowmin]);
581 outputmesh_set_pt(colmin, rowmax, dem_data[colmin][rowmax]);
582 outputmesh_set_pt(colmax, rowmax, dem_data[colmax][rowmax]);
583 outputmesh_set_pt(colmax, rowmin, dem_data[colmax][rowmin]);
585 printf("Beginning best fit procedure\n");
587 for ( row = rowmin; row <= rowmax; row++ ) {
588 // fit = fopen("fit.dat", "w");
589 // fit1 = fopen("fit1.dat", "w");
593 // printf(" fitting row = %d\n", row);
595 while ( start < colmax ) {
599 x[(end - start) - 1] = 0.0 + ( start * col_step );
600 y[(end - start) - 1] = dem_data[start][row];
602 while ( (end <= colmax) && good_fit ) {
603 n = (end - start) + 1;
604 // printf("Least square of first %d points\n", n);
605 x[end - start] = 0.0 + ( end * col_step );
606 y[end - start] = dem_data[end][row];
607 least_squares(x, y, n, &m, &b);
608 ave_error = least_squares_error(x, y, n, m, b);
609 max_error = least_squares_max_error(x, y, n, m, b);
612 printf("%d - %d ave error = %.2f max error = %.2f y = %.2f*x + %.2f\n",
613 start, end, ave_error, max_error, m, b);
615 f = fopen("gnuplot.dat", "w");
616 for ( j = 0; j <= end; j++) {
617 fprintf(f, "%.2f %.2f\n", 0.0 + ( j * col_step ),
620 for ( j = start; j <= end; j++) {
621 fprintf(f, "%.2f %.2f\n", 0.0 + ( j * col_step ),
626 printf("Please hit return: "); gets(junk);
629 if ( max_error > error ) {
637 // error exceeded the threshold, back up
638 end -= 2; // back "end" up to the last good enough fit
639 n--; // back "n" up appropriately too
641 // we popped out of the above loop while still within
642 // the error threshold, so we must be at the end of
647 least_squares(x, y, n, &m, &b);
648 ave_error = least_squares_error(x, y, n, m, b);
649 max_error = least_squares_max_error(x, y, n, m, b);
653 printf("%d - %d ave error = %.2f max error = %.2f y = %.2f*x + %.2f\n",
654 start, end, ave_error, max_error, m, b);
657 fprintf(fit1, "%.2f %.2f\n", x[0], m * x[0] + b);
658 fprintf(fit1, "%.2f %.2f\n", x[end-start], m * x[end-start] + b);
661 if ( start > colmin ) {
662 // skip this for the first line segment
664 outputmesh_set_pt(start, row, (lasty + cury) / 2);
665 // fprintf(fit, "%.2f %.2f\n", x[0], (lasty + cury) / 2);
668 lasty = m * x[end-start] + b;
676 dem = fopen("gnuplot.dat", "w");
677 for ( j = 0; j < DEM_SIZE_1; j++) {
678 fprintf(dem, "%.2f %.2f\n", 0.0 + ( j * col_step ),
684 // NOTICE, this is for testing only. This instance of
685 // output_nodes should be removed. It should be called only
686 // once at the end once all the nodes have been generated.
687 // newmesh_output_nodes(&nm, "mesh.node");
688 // printf("Please hit return: "); gets(junk);
691 // outputmesh_output_nodes(fg_root, p);
695 // Initialize output mesh structure
696 void FGDem::outputmesh_init( void ) {
699 for ( j = 0; j < DEM_SIZE_1; j++ ) {
700 for ( i = 0; i < DEM_SIZE_1; i++ ) {
701 output_data[i][j] = -9999.0;
707 // Get the value of a mesh node
708 double FGDem::outputmesh_get_pt( int i, int j ) {
709 return ( output_data[i][j] );
713 // Set the value of a mesh node
714 void FGDem::outputmesh_set_pt( int i, int j, double value ) {
715 // printf("Setting data[%d][%d] = %.2f\n", i, j, value);
716 output_data[i][j] = value;
720 // Write out a node file that can be used by the "triangle" program.
721 // Check for an optional "index.node.ex" file in case there is a .poly
722 // file to go along with this node file. Include these nodes first
723 // since they are referenced by position from the .poly file.
724 void FGDem::outputmesh_output_nodes( const string& fg_root, FGBucket& p )
726 double exnodes[MAX_EX_NODES][3];
727 struct stat stat_buf;
729 char file[256], exfile[256];
736 int colmin, colmax, rowmin, rowmax;
737 int i, j, count, excount, result;
739 // determine dimensions
740 colmin = p.get_x() * ( (cols - 1) / 8);
741 colmax = colmin + ( (cols - 1) / 8);
742 rowmin = p.get_y() * ( (rows - 1) / 8);
743 rowmax = rowmin + ( (rows - 1) / 8);
744 cout << " dumping region = " << colmin << "," << rowmin << " to " <<
745 colmax << "," << rowmax << "\n";
747 // generate the base directory
748 string base_path = p.gen_base_path();
749 cout << "fg_root = " << fg_root << " Base Path = " << base_path << endl;
750 dir = fg_root + "/Scenery/" + base_path;
751 cout << "Dir = " << dir << endl;
753 // stat() directory and create if needed
755 result = stat(dir.c_str(), &stat_buf);
756 if ( result != 0 && errno == ENOENT ) {
757 cout << "Creating directory\n";
761 command = "mkdir -p " + dir + "\n";
762 system( command.c_str() );
767 // Cygwin crashes when trying to output to node file
768 // explicitly making directory structure seems OK on Win95
770 extract_path (base_path, tmp_path);
772 dir = fg_root + "/Scenery";
773 if (my_mkdir ( dir.c_str() )) { exit (-1); }
775 dir = fg_root + "/Scenery/" + tmp_path;
776 if (my_mkdir ( dir.c_str() )) { exit (-1); }
778 dir = fg_root + "/Scenery/" + base_path;
779 if (my_mkdir ( dir.c_str() )) { exit (-1); }
785 // assume directory exists
788 // get index and generate output file name
789 index = p.gen_index();
790 sprintf(file, "%s/%ld.node", dir.c_str(), index);
792 // get (optional) extra node file name (in case there is matching
794 strcpy(exfile, file);
795 strcat(exfile, ".ex");
797 // load extra nodes if they exist
799 if ( (fd = fopen(exfile, "r")) != NULL ) {
801 fscanf(fd, "%d %d %d %d", &excount, &junki, &junki, &junki);
803 if ( excount > MAX_EX_NODES - 1 ) {
804 printf("Error, too many 'extra' nodes, increase array size\n");
807 printf(" Expecting %d 'extra' nodes\n", excount);
810 for ( i = 1; i <= excount; i++ ) {
811 fscanf(fd, "%d %lf %lf %lf\n", &junki,
812 &exnodes[i][0], &exnodes[i][1], &exnodes[i][2]);
813 printf("(extra) %d %.2f %.2f %.2f\n",
814 i, exnodes[i][0], exnodes[i][1], exnodes[i][2]);
819 printf("Creating node file: %s\n", file);
820 fd = fopen(file, "w");
822 // first count regular nodes to generate header
824 for ( j = rowmin; j <= rowmax; j++ ) {
825 for ( i = colmin; i <= colmax; i++ ) {
826 if ( output_data[i][j] > -9000.0 ) {
830 // printf(" count = %d\n", count);
832 fprintf(fd, "%d 2 1 0\n", count + excount);
834 // now write out extra node data
835 for ( i = 1; i <= excount; i++ ) {
836 fprintf(fd, "%d %.2f %.2f %.2f\n",
837 i, exnodes[i][0], exnodes[i][1], exnodes[i][2]);
840 // write out actual node data
842 for ( j = rowmin; j <= rowmax; j++ ) {
843 for ( i = colmin; i <= colmax; i++ ) {
844 if ( output_data[i][j] > -9000.0 ) {
845 fprintf(fd, "%d %.2f %.2f %.2f\n",
847 originx + (double)i * col_step,
848 originy + (double)j * row_step,
852 // printf(" count = %d\n", count);
860 FGDem::~FGDem( void ) {
861 // printf("class FGDem DEstructor called.\n");
863 delete [] output_data;
868 // Revision 1.27 1999/03/25 19:04:36 curt
869 // Minor tweaks related to FGBucket usage.
871 // Revision 1.26 1999/03/13 17:40:37 curt
872 // Moved point interpolation and least squares fitting to contruction program
874 // Moved leastsqs.* to Lib/Math/
876 // Revision 1.25 1999/03/12 22:53:07 curt
877 // Added a routine to dump out the portion of the dem data covered by a
878 // specified bucket. Other changes related to needs of scenery tools overhaul.
880 // Revision 1.24 1999/03/11 23:31:56 curt
881 // Tweaks to use newbucket.hxx
883 // Revision 1.23 1999/03/10 01:09:12 curt
884 // Tweaks to go along with scenery tools overhaul.
885 // Added a new constructor that accepts the file name.
887 // Revision 1.22 1999/01/19 20:56:56 curt
888 // MacOS portability changes contributed by "Robert Puyol" <puyol@abvent.fr>
890 // Revision 1.21 1998/11/06 14:04:32 curt
891 // Changes due to updates in fgstream.
893 // Revision 1.20 1998/10/28 19:38:20 curt
894 // Elliminate some unnecessary win32 specific stuff (by Norman Vine)
896 // Revision 1.19 1998/10/22 21:59:19 curt
897 // Fixed a couple subtle bugs that resulted from some of my c++ conversions.
898 // One bug could cause a segfault on certain input, and the other bug could
899 // cause the whole procedure to go balistic and generate huge files (also only
900 // on rare input combinations.)
902 // Revision 1.18 1998/10/18 01:17:09 curt
905 // Revision 1.17 1998/10/16 19:08:12 curt
906 // Portability updates from Bernie Bright.
908 // Revision 1.16 1998/10/02 21:41:39 curt
911 // Revision 1.15 1998/09/21 20:53:59 curt
912 // minor tweaks to clean a few additional things up after the rewrite.
914 // Revision 1.14 1998/09/19 17:59:45 curt
915 // Use c++ streams (fg_gzifstream). Also converted many character arrays to
918 // Revision 1.13 1998/09/09 16:24:04 curt
919 // Fixed a bug in the handling of exclude files which was causing
920 // a crash by calling fclose() on an invalid file handle.
922 // Revision 1.12 1998/08/24 20:03:31 curt
923 // Eliminated a possible memory overrun error.
924 // Use the proper free() rather than the incorrect delete().
926 // Revision 1.11 1998/07/20 12:46:11 curt
927 // When outputing to a .node file, first check for an optional
928 // "index.node.ex" file in case there is a .poly file to go along with this
929 // node file. Include these nodes first since they are referenced by position
930 // from the .poly file. This is my first pass at adding an area "cutout"
931 // feature to the terrain generation pipeline.
933 // Revision 1.10 1998/07/13 20:58:02 curt
936 // Revision 1.9 1998/07/13 15:29:49 curt
937 // Added #ifdef HAVE_CONFIG_H
939 // Revision 1.8 1998/07/04 00:47:18 curt
940 // typedef'd struct fgBUCKET.
942 // Revision 1.7 1998/06/05 18:14:39 curt
943 // Abort out early when reading the "A" record if it doesn't look like
944 // a proper DEM file.
946 // Revision 1.6 1998/05/02 01:49:21 curt
947 // Fixed a bug where the wrong variable was being initialized.
949 // Revision 1.5 1998/04/25 15:00:32 curt
950 // Changed "r" to "rb" in gzopen() options. This fixes bad behavior in win32.
952 // Revision 1.4 1998/04/22 13:14:46 curt
953 // Fixed a bug in zlib usage.
955 // Revision 1.3 1998/04/18 03:53:05 curt
956 // Added zlib support.
958 // Revision 1.2 1998/04/14 02:43:27 curt
959 // Used "new" to auto-allocate large DEM parsing arrays in class constructor.
961 // Revision 1.1 1998/04/08 22:57:22 curt
962 // Adopted Gnu automake/autoconf system.
964 // Revision 1.3 1998/04/06 21:09:41 curt
965 // Additional win32 support.
966 // Fixed a bad bug in dem file parsing that was causing the output to be
967 // flipped about x = y.
969 // Revision 1.2 1998/03/23 20:35:41 curt
970 // Updated to use FG_EPSILON
972 // Revision 1.1 1998/03/19 02:54:47 curt
973 // Reorganized into a class lib called fgDEM.
975 // Revision 1.1 1998/03/19 01:46:28 curt