]> git.mxchange.org Git - flightgear.git/commitdiff
Fixed bug in genfans (deleting the wrong triangles from the available pool.)
authorcurt <curt>
Wed, 31 Mar 1999 05:35:04 +0000 (05:35 +0000)
committercurt <curt>
Wed, 31 Mar 1999 05:35:04 +0000 (05:35 +0000)
Combine/genfans.cxx
GenOutput/genobj.cxx
Main/construct.cxx

index 05a16ea3dfea56d4dab899aa34873ec890c8068f..2dcab97fcb0384d699a61f0b9f1c8b9ca8fcb7b4 100644 (file)
@@ -70,7 +70,7 @@ static int_list make_best_fan( const triele_list& master_tris,
 
     // try starting with local triangle to find the best fan arrangement
     for ( int start = 0; start < (int)local_tris.size(); ++start ) {
-       cout << "trying with first triangle = " << local_tris[start] << endl;
+       // cout << "trying with first triangle = " << local_tris[start] << endl;
 
        int_list tmp_result;
        tmp_result.clear();
@@ -90,7 +90,7 @@ static int_list make_best_fan( const triele_list& master_tris,
                test = canonify( master_tris[local_tris[i]], center );
                if ( current_tri.get_n3() == test.get_n2() ) {
                    if ( i != start ) {
-                       cout << "  next triangle = " << local_tris[i] << endl;
+                       // cout << " next triangle = " << local_tris[i] << endl;
                        current_tri = test;
                        tmp_result.push_back( local_tris[i] );
                        matches = true;
@@ -103,12 +103,12 @@ static int_list make_best_fan( const triele_list& master_tris,
 
        if ( tmp_result.size() == local_tris.size() ) {
            // we found a complete usage, no need to go on
-           cout << "we found a complete usage, no need to go on" << endl;
+           // cout << "we found a complete usage, no need to go on" << endl;
            best_result = tmp_result;
            break;
        } else if ( tmp_result.size() > best_result.size() ) {
            // we found a better way to fan
-           cout << "we found a better fan arrangement" << endl;
+           // cout << "we found a better fan arrangement" << endl;
            best_result = tmp_result;
        }
     }
@@ -200,11 +200,17 @@ fan_list FGGenFans::greedy_build( triele_list tris ) {
        triele_list_iterator t_current = tris.begin();
        triele_list_iterator t_last = tris.end();
        counter = 0;
-       for ( ; t_current != t_last; ++t_current ) {
+       while ( t_current != t_last ) {
            if ( in_fan(counter, best_fan) ) {
-               cout << "erasing " << counter << " from master tri pool" 
+               cout << "erasing " 
+                    << t_current->get_n1() << ","
+                    << t_current->get_n2() << ","
+                    << t_current->get_n3()
+                    << " from master tri pool"
                     << endl;
                tris.erase( t_current );
+           } else {
+               ++t_current;
            }
            ++counter;
        }
@@ -232,6 +238,9 @@ double FGGenFans::ave_size() {
 
 
 // $Log$
+// Revision 1.3  1999/03/31 05:35:04  curt
+// Fixed bug in genfans (deleting the wrong triangles from the available pool.)
+//
 // Revision 1.2  1999/03/30 23:50:15  curt
 // Fannifier is clearly bugging ... working on debugging it.  I suspect there
 // is a problem related to deleting triangles from the triangle pool as they
index 0cbfdcdfe28348357b3109093a4830472025360e..9716cd617ec5cb7a791703650544204466609e25 100644 (file)
@@ -400,20 +400,22 @@ int FGGenOutput::write( const string& base, const FGBucket& b ) {
                }
                fprintf( fp, "\n" );
 
+#if 0
                {
-               int_list_iterator i_current = f_current->begin();
-               int_list_iterator i_last = f_current->end();
-               int center = *i_current;
-               ++i_current;
-               int n2 = *i_current;
-               ++i_current;
-               for ( ; i_current != i_last; ++i_current ) {
-                   int n3 = *i_current;
-                   fprintf( fp, "f %d %d %d\n", center, n2, n3 );
-                   ++total_tris;
-                   n2 = n3;
-               }
+                   int_list_iterator i_current = f_current->begin();
+                   int_list_iterator i_last = f_current->end();
+                   int center = *i_current;
+                   ++i_current;
+                   int n2 = *i_current;
+                   ++i_current;
+                   for ( ; i_current != i_last; ++i_current ) {
+                       int n3 = *i_current;
+                       fprintf( fp, "f %d %d %d\n", center, n2, n3 );
+                       ++total_tris;
+                       n2 = n3;
+                   }
                }
+#endif
            }
 
            fprintf( fp, "\n" );
@@ -431,6 +433,9 @@ int FGGenOutput::write( const string& base, const FGBucket& b ) {
 
 
 // $Log$
+// Revision 1.8  1999/03/31 05:35:05  curt
+// Fixed bug in genfans (deleting the wrong triangles from the available pool.)
+//
 // Revision 1.7  1999/03/30 23:50:43  curt
 // Modifications to fanify by attribute.
 //
index 4f6be6006c51acfb54011cd56256f18dde0033e8..224fa1bd3eb1fe6c32ef29b86e04b2ca1dfc41b3 100644 (file)
@@ -196,13 +196,13 @@ main(int argc, char **argv) {
     string work_base = argv[1];
     string output_base = argv[2];
    
-    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 = -89.744682312011719; lat= 29.314495086669922;
     // lon = -122.488090; lat = 42.743183;     // 64S
-    // lon = -114.861097; lat = 35.947480;     // 61B
+    lon = -114.861097; lat = 35.947480;     // 61B
     // lon = -112.012175; lat = 41.195944;     // KOGD
     // lon = -90.757128; lat = 46.790212;      // WI32
 
@@ -212,9 +212,9 @@ main(int argc, char **argv) {
     FGBucket b_max( lon + 1, lat + 1 );
 
     // FGBucket b(566664L);
-    FGBucket b(-146.248360, 61.133950);
-    construct_tile( work_base, output_base, b );
-    exit(0);
+    // FGBucket b(-146.248360, 61.133950);
+    // construct_tile( work_base, output_base, b );
+    // exit(0);
 
     if ( b_min == b_max ) {
        construct_tile( work_base, output_base, b_min );
@@ -230,9 +230,9 @@ main(int argc, char **argv) {
            for ( i = 0; i <= dx; i++ ) {
                b_cur = fgBucketOffset(min_x, min_y, i, j);
 
-               if ( b_cur != b ) {
-                   construct_tile( work_base, output_base, b_cur );
-               }
+               // if ( b_cur != b ) {
+               construct_tile( work_base, output_base, b_cur );
+               // }
            }
        }
        // string answer; cin >> answer;
@@ -241,6 +241,9 @@ main(int argc, char **argv) {
 
 
 // $Log$
+// Revision 1.13  1999/03/31 05:35:06  curt
+// Fixed bug in genfans (deleting the wrong triangles from the available pool.)
+//
 // Revision 1.12  1999/03/30 23:51:14  curt
 // fiddling ...
 //