]> git.mxchange.org Git - flightgear.git/commitdiff
Basic tile edge matching now seems to be working.
authorcurt <curt>
Tue, 4 May 1999 20:53:08 +0000 (20:53 +0000)
committercurt <curt>
Tue, 4 May 1999 20:53:08 +0000 (20:53 +0000)
Tools/Construct/Main/main.cxx
Tools/Construct/Match/match.cxx

index 1041b99b12cab9c70f69861493d80e8c78be39db..2b8ad4296541b4e20e92bd40eb99f2815c50d3a5 100644 (file)
@@ -454,10 +454,10 @@ main(int argc, char **argv) {
     c.set_min_nodes( 50 );
     c.set_max_nodes( (int)(FG_MAX_NODES * 0.8) );
 
-    // lon = -146.248360; lat = 61.133950;     // PAVD (Valdez, AK)
+    lon = -146.248360; lat = 61.133950;     // PAVD (Valdez, AK)
     // lon = -110.664244; lat = 33.352890;     // P13
     // lon = -93.211389; lat = 45.145000;      // KANE
-    lon = -92.486188; lat = 44.590190;      // KRGK
+    // lon = -92.486188; lat = 44.590190;      // KRGK
     // lon = -89.7446823; lat= 29.314495;
     // lon = -122.488090; lat = 42.743183;     // 64S
     // lon = -114.861097; lat = 35.947480;     // 61B
@@ -472,10 +472,12 @@ main(int argc, char **argv) {
     // lon = -121.914; lat = 42.5655;          // TEST (Oregon SW of Crater)
     // lon = -76.201239; lat = 36.894606;      // KORF (Norfolk, Virginia)
 
-    double min_x = lon - 3;
-    double min_y = lat - 1;
+    double xdist = 3.0;
+    double ydist = 1.0;
+    double min_x = lon - xdist;
+    double min_y = lat - ydist;
     FGBucket b_min( min_x, min_y );
-    FGBucket b_max( lon + 3, lat + 1 );
+    FGBucket b_max( lon + xdist, lat + ydist );
 
     FGBucket b_start(566777L);
     bool do_tile = true;
index ee31af3742c08dad867fd1bb0053cd52a786b085..47dff929c726840f546b6e086b1c687e5e3e0bf1 100644 (file)
@@ -45,11 +45,11 @@ void FGMatch::scan_share_file( const string& dir, const FGBucket& b,
                               neighbor_type search, neighbor_type dest )
 {
     string file = dir + "/"  + b.gen_base_path() + "/" + b.gen_index_str();
-    cout << "reading shared data from " << file << endl;
+    // cout << "reading shared data from " << file << endl;
 
     fg_gzifstream in( file );
     if ( !in.is_open() ) {
-        cout << "Cannot open file: " << file << endl;
+        // cout << "Cannot open file: " << file << endl;
        return;
     }
 
@@ -78,7 +78,7 @@ void FGMatch::scan_share_file( const string& dir, const FGBucket& b,
        in >> key;
        in >> node;
        if ( key == target ) {
-           cout << key << " " << node << endl;
+           // cout << key << " " << node << endl;
            in >> key;
            in >> normal;
 
@@ -140,6 +140,7 @@ void FGMatch::load_shared( const FGConstruct& c, neighbor_type n ) {
     FGBucket cb;
 
     if ( n == SW_Corner ) {
+       // cout << "searching for SW corner data" << endl;
        cb = fgBucketOffset(clon, clat, -1, 0);
        scan_share_file( base, cb, SE_Corner, n );
        cb = fgBucketOffset(clon, clat, -1, -1);
@@ -147,6 +148,7 @@ void FGMatch::load_shared( const FGConstruct& c, neighbor_type n ) {
        cb = fgBucketOffset(clon, clat, 0, -1);
        scan_share_file( base, cb, NW_Corner, n );
     } else if ( n == SE_Corner ) {
+       // cout << "searching for SE corner data" << endl;
        cb = fgBucketOffset(clon, clat, 0, -1);
        scan_share_file( base, cb, NE_Corner, n );
        cb = fgBucketOffset(clon, clat, 1, -1);
@@ -154,6 +156,7 @@ void FGMatch::load_shared( const FGConstruct& c, neighbor_type n ) {
        cb = fgBucketOffset(clon, clat, 1, 0);
        scan_share_file( base, cb, SW_Corner, n );
     } else if ( n == NE_Corner ) {
+       // cout << "searching for NE corner data" << endl;
        cb = fgBucketOffset(clon, clat, 1, 0);
        scan_share_file( base, cb, NW_Corner, n );
        cb = fgBucketOffset(clon, clat, 1, 1);
@@ -161,6 +164,7 @@ void FGMatch::load_shared( const FGConstruct& c, neighbor_type n ) {
        cb = fgBucketOffset(clon, clat, 0, 1);
        scan_share_file( base, cb, SE_Corner, n );
     } else if ( n == NW_Corner ) {
+       // cout << "searching for NW corner data" << endl;
        cb = fgBucketOffset(clon, clat, 0, 1);
        scan_share_file( base, cb, SW_Corner, n );
        cb = fgBucketOffset(clon, clat, -1, 1);
@@ -168,15 +172,19 @@ void FGMatch::load_shared( const FGConstruct& c, neighbor_type n ) {
        cb = fgBucketOffset(clon, clat, -1, 0);
        scan_share_file( base, cb, NE_Corner, n );
     } else if ( n == NORTH ) {
+       // cout << "searching for NORTH edge data" << endl;
        cb = fgBucketOffset(clon, clat, 0, 1);
        scan_share_file( base, cb, SOUTH, n );
     } else if ( n == SOUTH ) {
+       // cout << "searching for SOUTH edge data" << endl;
        cb = fgBucketOffset(clon, clat, 0, -1);
        scan_share_file( base, cb, NORTH, n );
     } else if ( n == EAST ) {
+       // cout << "searching for EAST edge data" << endl;
        cb = fgBucketOffset(clon, clat, 1, 0);
        scan_share_file( base, cb, WEST, n );
     } else if ( n == WEST ) {
+       // cout << "searching for WEST edge data" << endl;
        cb = fgBucketOffset(clon, clat, -1, 0);
        scan_share_file( base, cb, EAST, n );
     }
@@ -197,6 +205,11 @@ void FGMatch::load_neighbor_shared( FGConstruct& c ) {
     load_shared( c, NE_Corner );
     load_shared( c, NW_Corner );
 
+    north_nodes.clear();
+    south_nodes.clear();
+    east_nodes.clear();
+    west_nodes.clear();
+
     load_shared( c, NORTH );
     load_shared( c, SOUTH );
     load_shared( c, EAST );
@@ -222,10 +235,6 @@ void FGMatch::split_tile( FGConstruct& c ) {
 
     // separate nodes and normals into components
 
-    north_nodes.clear();
-    south_nodes.clear();
-    east_nodes.clear();
-    west_nodes.clear();
     body_nodes.clear();
 
     point_list nodes = c.get_geod_nodes();
@@ -337,6 +346,7 @@ void FGMatch::write_shared( FGConstruct& c ) {
 
     system(command.c_str());
 
+#if 0
     cout << "FLAGS" << endl;
     cout << "=====" << endl;
     cout << "sw_flag = " << sw_flag << endl;
@@ -347,6 +357,7 @@ void FGMatch::write_shared( FGConstruct& c ) {
     cout << "south_flag = " << south_flag << endl;
     cout << "east_flag = " << east_flag << endl;
     cout << "west_flag = " << west_flag << endl;
+#endif
 
     FILE *fp;
     if ( (fp = fopen( file.c_str(), "w" )) == NULL ) {
@@ -539,7 +550,9 @@ void FGMatch::assemble_tile( FGConstruct& c ) {
        insert_normal( new_normals, east_normals[i], index );
     }
 
+    // cout << "Total west nodes = " << west_nodes.size() << endl;
     for ( int i = 0; i < (int)west_nodes.size(); ++i ) {
+       // cout << "adding west node " << west_nodes[i] << endl;
        index = new_nodes.unique_add( west_nodes[i] );
        insert_normal( new_normals, west_normals[i], index );
     }