diff --git a/README.cygwin b/README.cygwin new file mode 100644 index 00000000..9f5a7646 --- /dev/null +++ b/README.cygwin @@ -0,0 +1,46 @@ +Building the tools with Cygwin +------------------------------ + +In order to make Terragear with Cygwin, it is necessary to remove the 'Parallel' directory from 'SUBDIRS' in the makefile in Terragear/src/construct. The parallel building tools don't appear to have a hope of building on Windoze as is, and are not needed to run the tools on one machine only. + +Other than that, + +./configure make make install + +should now work fine. If make dies with references to fg_path in array.cxx then your version of Simgear is out of date. + + +Using the tools on Windoze +-------------------------- + +Firstly, its usefull to have a scroll buffer in action on your Windoze command prompt in order to view the copious output from the tools. If you havn't got it or an alternative already, then the consize utility from http://cygutils.netpedia.net/ is excellent. Note that on Win9x you'll also need a 32bit command prompt to use it, also available from the same site. None of this is necessary to run the Terragear tools, but I find that it makes all command prompt operations a lot easier. + +Instructions on using the tools are available in Alexi's README.howto, the following is intended as clarification for Windoze users. Note that running: + -help +should print out the usage for any of the tools. + +-------------------------- + +raw2ascii should work fine, except that you will have to create your output directory manually. An example command line is: + +F:\unix\usr\local\bin>raw2ascii f:\unix\dem\w020n90\w020n90 f:\unix\dem\w020n90\output + +It appears that (currently, 26/10/00) the Terragear tools are unable to create directories in Windoze (I've only tested this on NT4 BTW) so if you get an error message along the lines of: + +"Error opening output file = f:\unix\dem\w020n90\output/w020n40.dem" + +then check that you've created the output directory that you've asked it to put the files in. + +However, it appears that the code attempts to gzip the output files, but fails on windoze, so you'll have to gzip them manually if you want. This will save a *lot* of space. + +-------------------------- + +demchop seems to work in most cases, except that once again you'll have to create the output directories when it complains about being unable to open a file. Make sure you use the dem-30 or dem-3 directories described in Alexi's readme since this is where the final construction stage will automatically look for the chopped files. You don't need the .gz extension when using demchop, so the example command line: + +F:\unix\usr\local\bin>demchop f:\unix\dem\w020n90\output\w002n52.dem f:\unix\dem\w020n90\dem-30 + +will chop either w002n52.dem or w002n52.dem.gz In this instance you would have to manually create the directories w010n50 and w002n52 as subdirectories of dem-30 when it complains about being unable to open a file. + +Unfortunately some files are giving me stackdumps when running demchop on them and I havn't figured out why yet. + +And that's as far as I've got. \ No newline at end of file diff --git a/src/BuildTiles/Main/main.cxx b/src/BuildTiles/Main/main.cxx index f49a0bad..a810d089 100644 --- a/src/BuildTiles/Main/main.cxx +++ b/src/BuildTiles/Main/main.cxx @@ -841,6 +841,9 @@ int main(int argc, char **argv) { cout << "Load directory: " << argv[i] << endl; } +#if defined( __CYGWIN__ ) || defined( __CYGWIN32__ ) + // the next bit crashes Cygwin for me - DCL +#else // set mem allocation limit. Reason: occasionally the triangle() // routine can blow up and allocate memory forever. We'd like // this process to die before things get out of hand so we can try @@ -864,7 +867,8 @@ int main(int argc, char **argv) { limit.rlim_max = 120; result = setrlimit( RLIMIT_CPU, &limit ); cout << "result of setting mem limit = " << result << endl; - +#endif // end of stuff that crashes Cygwin + // main construction data management class FGConstruct c; diff --git a/src/BuildTiles/Triangulate/triangle.cxx b/src/BuildTiles/Triangulate/triangle.cxx index 18f3e73e..51d30d58 100644 --- a/src/BuildTiles/Triangulate/triangle.cxx +++ b/src/BuildTiles/Triangulate/triangle.cxx @@ -119,11 +119,20 @@ FGTriangle::build( const point_list& corner_list, // fclose(junkfp); } + // for each contour, calculate a point inside (but not + // also inside any interior contours + + // new way + calc_points_inside( gpc_poly ); + +#if 0 + // old way Point3D inside_pt; for ( j = 0; j < gpc_poly.contours(); ++j ) { inside_pt = calc_point_inside( gpc_poly, j, in_nodes ); gpc_poly.set_point_inside( j, inside_pt ); } +#endif polylist[i].push_back( gpc_poly ); diff --git a/src/Lib/Geometry/poly_support.cxx b/src/Lib/Geometry/poly_support.cxx index a3c695de..3b2dfb32 100644 --- a/src/Lib/Geometry/poly_support.cxx +++ b/src/Lib/Geometry/poly_support.cxx @@ -100,8 +100,8 @@ static bool intersects( Point3D p0, Point3D p1, double x, Point3D *result ) { // calculate some "arbitrary" point inside the specified contour for // assigning attribute areas -Point3D calc_point_inside( const FGPolygon& p, const int contour, - const FGTriNodes& trinodes ) { +Point3D calc_point_inside_old( const FGPolygon& p, const int contour, + const FGTriNodes& trinodes ) { Point3D tmp, min, ln, p1, p2, p3, m, result, inside_pt; int min_node_index = 0; int min_index = 0; @@ -866,8 +866,7 @@ static void build_contour_tree( FGContourNode *node, } -// calculate some "arbitrary" point inside the specified contour for -// assigning attribute areas +// calculate some "arbitrary" point inside each of the polygons contours void calc_points_inside( FGPolygon& p ) { // first build the contour tree diff --git a/src/Lib/Geometry/poly_support.hxx b/src/Lib/Geometry/poly_support.hxx index 5f5cf72e..e8ac2ebf 100644 --- a/src/Lib/Geometry/poly_support.hxx +++ b/src/Lib/Geometry/poly_support.hxx @@ -55,10 +55,11 @@ FGPolygon polygon_tesselate_alt( FGPolygon &p ); // calculate some "arbitrary" point inside the specified contour for // assigning attribute areas. This requires data structures outside -// of "FGPolygon" which is why it is living over here in "Lib/Build" -Point3D calc_point_inside( const FGPolygon& p, const int contour, - const FGTriNodes& trinodes ); +// of "FGPolygon" which is why it is living over here in "Lib/Geometry" +Point3D calc_point_inside_old( const FGPolygon& p, const int contour, + const FGTriNodes& trinodes ); +// calculate some "arbitrary" point inside each of the polygons contours void calc_points_inside( FGPolygon& p ); diff --git a/src/Lib/poly2tri/misc.c b/src/Lib/poly2tri/misc.c index 4d3c6fef..99edbc55 100644 --- a/src/Lib/poly2tri/misc.c +++ b/src/Lib/poly2tri/misc.c @@ -2,10 +2,9 @@ #include #include -#ifdef __STDC__ -extern double log2(double); -#else -extern double log2(); +#if defined( __CYGWIN__ ) || defined( __CYGWIN32__ ) +#define lrand48() rand() +#define srand48(x) srand(x) #endif static int choose_idx; diff --git a/src/Prep/DemRaw2ascii/rawdem.c b/src/Prep/DemRaw2ascii/rawdem.c index 781506a8..e2f5bc8a 100644 --- a/src/Prep/DemRaw2ascii/rawdem.c +++ b/src/Prep/DemRaw2ascii/rawdem.c @@ -148,7 +148,11 @@ void rawReadDemHdr( fgRAWDEM *raw, char *hdr_file ) { /* Open a raw DEM file. */ void rawOpenDemFile( fgRAWDEM *raw, char *raw_dem_file ) { printf("Opening Raw DEM file: %s\n", raw_dem_file); +#if ! defined( WIN32 ) if ( (raw->fd = open(raw_dem_file ,O_RDONLY)) == -1 ) { +#else + if ( (raw->fd = open(raw_dem_file ,O_RDONLY | O_BINARY)) == -1 ) { +#endif printf("Error opening Raw DEM file: %s\n", raw_dem_file); exit(-1); }