1
0
Fork 0

Fixed bug in genfans (deleting the wrong triangles from the available pool.)

This commit is contained in:
curt 1999-03-31 05:35:04 +00:00
parent 6a7b127577
commit 8a691a975f
3 changed files with 43 additions and 26 deletions

View 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 // try starting with local triangle to find the best fan arrangement
for ( int start = 0; start < (int)local_tris.size(); ++start ) { 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; int_list tmp_result;
tmp_result.clear(); 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 ); test = canonify( master_tris[local_tris[i]], center );
if ( current_tri.get_n3() == test.get_n2() ) { if ( current_tri.get_n3() == test.get_n2() ) {
if ( i != start ) { if ( i != start ) {
cout << " next triangle = " << local_tris[i] << endl; // cout << " next triangle = " << local_tris[i] << endl;
current_tri = test; current_tri = test;
tmp_result.push_back( local_tris[i] ); tmp_result.push_back( local_tris[i] );
matches = true; matches = true;
@ -103,12 +103,12 @@ static int_list make_best_fan( const triele_list& master_tris,
if ( tmp_result.size() == local_tris.size() ) { if ( tmp_result.size() == local_tris.size() ) {
// we found a complete usage, no need to go on // 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; best_result = tmp_result;
break; break;
} else if ( tmp_result.size() > best_result.size() ) { } else if ( tmp_result.size() > best_result.size() ) {
// we found a better way to fan // 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; 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_current = tris.begin();
triele_list_iterator t_last = tris.end(); triele_list_iterator t_last = tris.end();
counter = 0; counter = 0;
for ( ; t_current != t_last; ++t_current ) { while ( t_current != t_last ) {
if ( in_fan(counter, best_fan) ) { 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; << endl;
tris.erase( t_current ); tris.erase( t_current );
} else {
++t_current;
} }
++counter; ++counter;
} }
@ -232,6 +238,9 @@ double FGGenFans::ave_size() {
// $Log$ // $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 // Revision 1.2 1999/03/30 23:50:15 curt
// Fannifier is clearly bugging ... working on debugging it. I suspect there // Fannifier is clearly bugging ... working on debugging it. I suspect there
// is a problem related to deleting triangles from the triangle pool as they // is a problem related to deleting triangles from the triangle pool as they

View file

@ -400,20 +400,22 @@ int FGGenOutput::write( const string& base, const FGBucket& b ) {
} }
fprintf( fp, "\n" ); fprintf( fp, "\n" );
#if 0
{ {
int_list_iterator i_current = f_current->begin(); int_list_iterator i_current = f_current->begin();
int_list_iterator i_last = f_current->end(); int_list_iterator i_last = f_current->end();
int center = *i_current; int center = *i_current;
++i_current; ++i_current;
int n2 = *i_current; int n2 = *i_current;
++i_current; ++i_current;
for ( ; i_current != i_last; ++i_current ) { for ( ; i_current != i_last; ++i_current ) {
int n3 = *i_current; int n3 = *i_current;
fprintf( fp, "f %d %d %d\n", center, n2, n3 ); fprintf( fp, "f %d %d %d\n", center, n2, n3 );
++total_tris; ++total_tris;
n2 = n3; n2 = n3;
} }
} }
#endif
} }
fprintf( fp, "\n" ); fprintf( fp, "\n" );
@ -431,6 +433,9 @@ int FGGenOutput::write( const string& base, const FGBucket& b ) {
// $Log$ // $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 // Revision 1.7 1999/03/30 23:50:43 curt
// Modifications to fanify by attribute. // Modifications to fanify by attribute.
// //

View file

@ -196,13 +196,13 @@ main(int argc, char **argv) {
string work_base = argv[1]; string work_base = argv[1];
string output_base = argv[2]; 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 = -110.664244; lat = 33.352890; // P13
// lon = -93.211389; lat = 45.145000; // KANE // lon = -93.211389; lat = 45.145000; // KANE
// lon = -92.486188; lat = 44.590190; // KRGK // lon = -92.486188; lat = 44.590190; // KRGK
// lon = -89.744682312011719; lat= 29.314495086669922; // lon = -89.744682312011719; lat= 29.314495086669922;
// lon = -122.488090; lat = 42.743183; // 64S // 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 = -112.012175; lat = 41.195944; // KOGD
// lon = -90.757128; lat = 46.790212; // WI32 // 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_max( lon + 1, lat + 1 );
// FGBucket b(566664L); // FGBucket b(566664L);
FGBucket b(-146.248360, 61.133950); // FGBucket b(-146.248360, 61.133950);
construct_tile( work_base, output_base, b ); // construct_tile( work_base, output_base, b );
exit(0); // exit(0);
if ( b_min == b_max ) { if ( b_min == b_max ) {
construct_tile( work_base, output_base, b_min ); construct_tile( work_base, output_base, b_min );
@ -230,9 +230,9 @@ main(int argc, char **argv) {
for ( i = 0; i <= dx; i++ ) { for ( i = 0; i <= dx; i++ ) {
b_cur = fgBucketOffset(min_x, min_y, i, j); b_cur = fgBucketOffset(min_x, min_y, i, j);
if ( b_cur != b ) { // if ( b_cur != b ) {
construct_tile( work_base, output_base, b_cur ); construct_tile( work_base, output_base, b_cur );
} // }
} }
} }
// string answer; cin >> answer; // string answer; cin >> answer;
@ -241,6 +241,9 @@ main(int argc, char **argv) {
// $Log$ // $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 // Revision 1.12 1999/03/30 23:51:14 curt
// fiddling ... // fiddling ...
// //