]> git.mxchange.org Git - flightgear.git/commitdiff
Found a bug in dividing and adding unique verticle segments which could
authorcurt <curt>
Sat, 3 Apr 1999 05:22:57 +0000 (05:22 +0000)
committercurt <curt>
Sat, 3 Apr 1999 05:22:57 +0000 (05:22 +0000)
cause the triangulator to end up in an infinite loop.  Basically the code
was correct, but the verticle line test was a bit to selective.

Main/construct.cxx
Triangulate/triangle.cxx
Triangulate/trisegs.cxx

index 12099f9283f47c216362ea257c8addedbbd8db9d..85227747b8725ea0763daa4a0489774c3fc86cda 100644 (file)
@@ -206,7 +206,8 @@ main(int argc, char **argv) {
     // lon = -112.012175; lat = 41.195944;     // KOGD
     // lon = -90.757128; lat = 46.790212;      // WI32
     // lon = -122.220717; lat = 37.721291;     // KOAK
-    lon = -111.721477; lat = 40.215641;     // KPVU
+    // lon = -111.721477; lat = 40.215641;     // KPVU
+    lon = -122.309313; lat = 47.448982;     // KSEA
 
     double min_x = lon - 1;
     double min_y = lat - 1;
@@ -214,6 +215,7 @@ main(int argc, char **argv) {
     FGBucket b_max( lon + 1, lat + 1 );
 
     FGBucket b_omit(550314L);
+    // FGBucket b(942698L);
     // FGBucket b(-146.248360, 61.133950);
     // construct_tile( work_base, output_base, b );
     // exit(0);
@@ -243,6 +245,11 @@ main(int argc, char **argv) {
 
 
 // $Log$
+// Revision 1.17  1999/04/03 05:22:57  curt
+// Found a bug in dividing and adding unique verticle segments which could
+// cause the triangulator to end up in an infinite loop.  Basically the code
+// was correct, but the verticle line test was a bit to selective.
+//
 // Revision 1.16  1999/04/01 13:52:12  curt
 // Version 0.6.0
 // Shape name tweak.
index 6265237b0a8d8256392c233bf50f9462ade506a9..6ce08c492d66cbdc390473c62c100231831073fd 100644 (file)
@@ -328,7 +328,7 @@ int FGTriangle::run_triangulate() {
     vorout.normlist = (REAL *) NULL;      // Needed only if -v switch used.
     
     // TEMPORARY
-    // write_out_data(&in);
+    write_out_data(&in);
 
     // Triangulate the points.  Switches are chosen to read and write
     // a PSLG (p), preserve the convex hull (c), number everything
@@ -343,7 +343,7 @@ int FGTriangle::run_triangulate() {
     triangulate(tri_options.c_str(), &in, &out, &vorout);
 
     // TEMPORARY
-    write_out_data(&out);
+    // write_out_data(&out);
 
     // now copy the results back into the corresponding FGTriangle
     // structures
@@ -398,6 +398,11 @@ int FGTriangle::run_triangulate() {
 
 
 // $Log$
+// Revision 1.15  1999/04/03 05:22:58  curt
+// Found a bug in dividing and adding unique verticle segments which could
+// cause the triangulator to end up in an infinite loop.  Basically the code
+// was correct, but the verticle line test was a bit to selective.
+//
 // Revision 1.14  1999/03/31 23:47:09  curt
 // Debugging output tweaks.
 //
index 1c1c386bf2facf963e3d7474890f5c72b7ae51fc..d05c6ccf190ec7dc2f8bc90dda6eb23b15a00f47 100644 (file)
@@ -87,7 +87,7 @@ void FGTriSegments::unique_divide_and_add( const point_list& nodes,
     //   temp = true;
     // }
 
-    if ( fabs(p0.x() - p1.x()) > FG_EPSILON ) {
+    if ( fabs(p0.x() - p1.x()) > 3 * FG_EPSILON ) {
        // use y = mx + b
 
        // sort these in a sensable order
@@ -131,6 +131,8 @@ void FGTriSegments::unique_divide_and_add( const point_list& nodes,
     } else {
        // use x = constant
 
+       // cout << "FOUND VERTICLE SEGMENT" << endl;
+
        // sort these in a sensable order
        if ( p0.y() > p1.y() ) {
            Point3D tmp = p0;
@@ -138,15 +140,22 @@ void FGTriSegments::unique_divide_and_add( const point_list& nodes,
            p1 = tmp;
        }
 
+       // cout << " p0 = " << p0 << " p1 = " << p1 << endl;
+
        current = nodes.begin();
        last = nodes.end();
        counter = 0;
        for ( ; current != last; ++current ) {
            // cout << counter << endl;
-           if ( (current->y() > p0.y()) && (current->y() < p1.y()) ) {
+           if ( (current->y() > (p0.y() + FG_EPSILON))
+                && (current->y() < (p1.y() - FG_EPSILON)) ) {
                x_err = fabs(current->x() - p0.x());
+               // cout << "  found a potential point, x err = " 
+               //      << x_err << endl;
                if ( x_err < 10*FG_EPSILON ) {
                    cout << "FOUND EXTRA SEGMENT NODE (X)" << endl;
+                   cout << p0 << " < " << *current << " < "
+                        << p1 << endl;
                    found_extra = true;
                    extra_index = counter;
                    break;
@@ -170,6 +179,11 @@ void FGTriSegments::unique_divide_and_add( const point_list& nodes,
 
 
 // $Log$
+// Revision 1.6  1999/04/03 05:22:59  curt
+// Found a bug in dividing and adding unique verticle segments which could
+// cause the triangulator to end up in an infinite loop.  Basically the code
+// was correct, but the verticle line test was a bit to selective.
+//
 // Revision 1.5  1999/03/29 13:11:13  curt
 // Shuffled stl type names a bit.
 // Began adding support for tri-fanning (or maybe other arrangments too.)