]> git.mxchange.org Git - flightgear.git/commitdiff
Continued work on triangulation preparation.
authorcurt <curt>
Fri, 19 Mar 1999 00:27:09 +0000 (00:27 +0000)
committercurt <curt>
Fri, 19 Mar 1999 00:27:09 +0000 (00:27 +0000)
Triangulate/Makefile.am
Triangulate/triangle.cxx
Triangulate/triangle.hxx
Triangulate/trinodes.cxx

index 503e359b20dee0b8e1a40a1a16b582efc923eeda..f28601c0d71c0c251d7c1bb32ce98e6ff3a33cca 100644 (file)
@@ -7,4 +7,5 @@ libTriangulate_a_SOURCES = \
 INCLUDES += \
        -I$(top_builddir) \
        -I$(top_builddir)/Lib \
+       -I$(top_builddir)/Tools/Lib \
        -I$(top_builddir)/Tools/Construct
index 992549214594da0a009283668101602cb7951f47..1d90cbfbe8f99ef82c69a4e49d1cfddcef91bb62 100644 (file)
@@ -37,6 +37,9 @@ FGTriangle::~FGTriangle( void ) {
 
 // populate this class based on the specified gpc_polys list
 int FGTriangle::build( const FGgpcPolyList& gpc_polys ) {
+    int index;
+    tripoly poly;
+
     // traverse the gpc_polys and build a unified node list and a set
     // of Triangle PSLG that reference the node list by index
     // (starting at zero)
@@ -47,29 +50,52 @@ int FGTriangle::build( const FGgpcPolyList& gpc_polys ) {
     // process polygons in priority order
     cout << "prepairing node list and polygons" << endl;
 
-    for ( int i = 0; i < FG_MAX_AREAS; ++i ) {
+    for ( int i = 0; i < FG_MAX_AREA_TYPES; ++i ) {
        cout << "area type = " << i << endl;
        current = gpc_polys.polys[i].begin();
        last = gpc_polys.polys[i].end();
        for ( ; current != last; ++current ) {
            gpc_poly = *current;
+           cout << "processing a polygon, contours = " 
+                << gpc_poly->num_contours << endl;
+
+           poly.erase(poly.begin(), poly.end());
+
+           if (gpc_poly->num_contours <= 0 ) {
+               cout << "FATAL ERROR! no contours in this polygon" << endl;
+               exit(-1);
+           }
+
+           if (gpc_poly->num_contours > 1 ) {
+               cout << "FATAL ERROR! no multi-contour support" << endl;
+               exit(-1);
+           }
 
            for ( int j = 0; j < gpc_poly->num_contours; j++ ) {
                for ( int k = 0; k < gpc_poly->contour[j].num_vertices; k++ ) {
                    Point3D p( gpc_poly->contour[j].vertex[k].x,
                               gpc_poly->contour[j].vertex[k].y,
                               0 );
-                   cout << trinodes.unique_add( p ) << endl;
+                   index = trinodes.unique_add( p );
+                   poly.push_back(index);
+                   // cout << index << endl;
                }
+               polylist[i].push_back(poly);
            }
        }
     }
 
+    for ( int i = 0; i < FG_MAX_AREA_TYPES; ++i ) {
+       cout << "polylist[" << i << "] = " << polylist[i].size() << endl;
+    }
     return 0;
 }
 
 
 // $Log$
+// Revision 1.3  1999/03/19 00:27:10  curt
+// Continued work on triangulation preparation.
+//
 // Revision 1.2  1999/03/18 04:31:11  curt
 // Let's not pass copies of huge structures on the stack ... ye might see a
 // segfault ... :-)
index 1dbb85e248f116a1843467c6c46333c2f8b1acf0..9ba18005b811561da6660669c1ae0288479ebafa 100644 (file)
@@ -37,6 +37,7 @@
 
 #include <Clipper/clipper.hxx>
 #include <Math/point3d.hxx>
+#include <Polygon/names.hxx>
 
 #include "trinodes.hxx"
 
@@ -47,7 +48,7 @@ typedef vector < int > tripoly;
 typedef tripoly::iterator tripoly_iterator;
 typedef tripoly::const_iterator const_tripoly_iterator;
 
-typedef vector < int > tripoly_list;
+typedef vector < tripoly > tripoly_list;
 typedef tripoly_list::iterator tripoly_list_iterator;
 typedef tripoly_list::const_iterator const_tripoly_list_iterator;
 
@@ -57,7 +58,7 @@ class FGTriangle {
 private:
 
     FGTriNodes trinodes;
-    tripoly_list polylist;
+    tripoly_list polylist[FG_MAX_AREA_TYPES];
 
 public:
 
@@ -74,6 +75,9 @@ public:
 
 
 // $Log$
+// Revision 1.3  1999/03/19 00:27:11  curt
+// Continued work on triangulation preparation.
+//
 // Revision 1.2  1999/03/18 04:31:12  curt
 // Let's not pass copies of huge structures on the stack ... ye might see a
 // segfault ... :-)
index 5c2508e000374dd4e360111977eb316dd6973859..82c2b69331c0cb64793db67746164c23dcc68aca 100644 (file)
@@ -53,11 +53,14 @@ int FGTriNodes::unique_add( const Point3D& p ) {
     point_iterator current, last;
     int counter = 0;
 
+    // cout << p.x() << "," << p.y() << endl;
+
     // see if point already exists
     current = point_list.begin();
     last = point_list.end();
     for ( ; current != last; ++current ) {
        if ( close_enough(p, *current) ) {
+           cout << "found an existing match!" << endl;
            return counter;
        }
        
@@ -72,6 +75,9 @@ int FGTriNodes::unique_add( const Point3D& p ) {
 
 
 // $Log$
+// Revision 1.2  1999/03/19 00:27:12  curt
+// Continued work on triangulation preparation.
+//
 // Revision 1.1  1999/03/17 23:52:00  curt
 // Initial revision.
 //