diff --git a/Array/array.cxx b/Array/array.cxx index ad875f587..90e04142d 100644 --- a/Array/array.cxx +++ b/Array/array.cxx @@ -60,14 +60,14 @@ FG_USING_STD(string); FGArray::FGArray( void ) { // cout << "class FGArray CONstructor called." << endl; in_data = new float[ARRAY_SIZE_1][ARRAY_SIZE_1]; - out_data = new float[ARRAY_SIZE_1][ARRAY_SIZE_1]; + // out_data = new float[ARRAY_SIZE_1][ARRAY_SIZE_1]; } FGArray::FGArray( const string &file ) { // cout << "class FGArray CONstructor called." << endl; in_data = new float[ARRAY_SIZE_1][ARRAY_SIZE_1]; - out_data = new float[ARRAY_SIZE_1][ARRAY_SIZE_1]; + // out_data = new float[ARRAY_SIZE_1][ARRAY_SIZE_1]; FGArray::open(file); } @@ -130,6 +130,16 @@ FGArray::parse() { } +// add a node to the output (fitted) node list +void FGArray::add_fit_node( int i, int j, double val ) { + double x = (originx + i * col_step) / 3600.0; + double y = (originy + j * row_step) / 3600.0; + cout << Point3D(x, y, val) << endl; + node_list.push_back( Point3D(x, y, val) ); +} + + +#if 0 // Initialize output mesh structure void FGArray::outputmesh_init( void ) { int i, j; @@ -153,6 +163,7 @@ void FGArray::outputmesh_set_pt( int i, int j, double value ) { // cout << "Setting data[" << i << "][" << j << "] = " << value << endl; out_data[i][j] = value; } +#endif // Use least squares to fit a simpler data set to dem data @@ -170,7 +181,7 @@ void FGArray::fit( double error ) { error_sq = error * error; cout << " Initializing output mesh structure" << endl; - outputmesh_init(); + // outputmesh_init(); // determine dimensions colmin = 0; @@ -181,10 +192,10 @@ void FGArray::fit( double error ) { << colmax << "," << rowmax << endl;; // include the corners explicitly - outputmesh_set_pt(colmin, rowmin, in_data[colmin][rowmin]); - outputmesh_set_pt(colmin, rowmax, in_data[colmin][rowmax]); - outputmesh_set_pt(colmax, rowmax, in_data[colmax][rowmax]); - outputmesh_set_pt(colmax, rowmin, in_data[colmax][rowmin]); + add_fit_node( colmin, rowmin, in_data[colmin][rowmin] ); + add_fit_node( colmin, rowmax-1, in_data[colmin][rowmax] ); + add_fit_node( colmax-1, rowmin, in_data[colmax][rowmin] ); + add_fit_node( colmax-1, rowmax-1, in_data[colmax][rowmax] ); cout << " Beginning best fit procedure" << endl; lasty = 0; @@ -276,7 +287,7 @@ void FGArray::fit( double error ) { if ( start > colmin ) { // skip this for the first line segment cury = m * x[0] + b; - outputmesh_set_pt(start, row, (lasty + cury) / 2); + add_fit_node( start, row, (lasty + cury) / 2 ); // fprintf(fit, "%.2f %.2f\n", x[0], (lasty + cury) / 2); } @@ -544,11 +555,15 @@ void FGArray::outputmesh_output_nodes( const string& fg_root, FGBucket& p ) FGArray::~FGArray( void ) { // printf("class FGArray DEstructor called.\n"); delete [] in_data; - delete [] out_data; + // delete [] out_data; } // $Log$ +// Revision 1.4 1999/03/20 20:32:51 curt +// First mostly successful tile triangulation works. There's plenty of tweaking +// to do, but we are marching in the right direction. +// // Revision 1.3 1999/03/17 23:48:17 curt // Removed forced -g compile flag. // Fixed a couple compiler warnings. diff --git a/Array/array.hxx b/Array/array.hxx index 087c8c7d2..f90b88b92 100644 --- a/Array/array.hxx +++ b/Array/array.hxx @@ -31,14 +31,26 @@ #endif +#include + +#include + #include +#include #include +FG_USING_STD(vector); + #define ARRAY_SIZE 1200 #define ARRAY_SIZE_1 1201 +typedef vector < Point3D > fitnode_list; +typedef fitnode_list::iterator fitnode_list_iterator; +typedef fitnode_list::const_iterator const_fitnode_list_iterator; + + class FGArray { private: @@ -58,37 +70,23 @@ private: // pointers to the actual grid data allocated here float (*in_data)[ARRAY_SIZE_1]; - float (*out_data)[ARRAY_SIZE_1]; + // float (*out_data)[ARRAY_SIZE_1]; - // Current "A" Record Information - // char dem_description[80], dem_quadrangle[80]; - // double dem_x1, dem_y1, dem_x2, dem_y2, dem_x3, dem_y3, dem_x4, dem_y4; - // double dem_z1, dem_z2; - // int dem_resolution, dem_num_profiles; - - // Current "B" Record Information - // int prof_col, prof_row; - // int prof_num_cols, prof_num_rows; - // double prof_x1, prof_y1; - // int prof_data; - - // temporary values for the class to use - // char option_name[32]; - // int do_data; - // int cur_col, cur_row; + // output nodes + fitnode_list node_list; // Initialize output mesh structure - void outputmesh_init( void ); + // void outputmesh_init( void ); // Get the value of a mesh node - double outputmesh_get_pt( int i, int j ); + // double outputmesh_get_pt( int i, int j ); // Set the value of a mesh node - void outputmesh_set_pt( int i, int j, double value ); + // void outputmesh_set_pt( int i, int j, double value ); #if 0 // Write out a node file that can be used by the "triangle" program - void outputmesh_output_nodes( const string& fg_root, FGBucket& p ); + // void outputmesh_output_nodes( const string& fg_root, FGBucket& p ); #endif public: @@ -112,6 +110,9 @@ public: // Use least squares to fit a simpler data set to dem data void fit( double error ); + // add a node to the output (fitted) node list + void add_fit_node( int i, int j, double val ); + // return the current altitude based on grid data. We should // rewrite this to interpolate exact values, but for now this is // good enough @@ -124,6 +125,8 @@ public: inline int get_rows() const { return rows; } inline double get_col_step() const { return col_step; } inline double get_row_step() const { return row_step; } + + inline fitnode_list get_fit_node_list() const { return node_list; } }; @@ -131,6 +134,10 @@ public: // $Log$ +// Revision 1.3 1999/03/20 20:32:52 curt +// First mostly successful tile triangulation works. There's plenty of tweaking +// to do, but we are marching in the right direction. +// // Revision 1.2 1999/03/13 23:50:27 curt // Tweaked output formatting a bit. // diff --git a/Main/Makefile.am b/Main/Makefile.am index 2c4b964c5..618351e7f 100644 --- a/Main/Makefile.am +++ b/Main/Makefile.am @@ -7,6 +7,7 @@ construct_LDADD = \ $(top_builddir)/Tools/Construct/Clipper/libClipper.a \ $(top_builddir)/Tools/Construct/Triangulate/libTriangulate.a \ $(top_builddir)/Tools/Lib/Polygon/libPolygon.a \ + $(top_builddir)/Tools/Lib/Triangle/libTriangle.a \ $(top_builddir)/Lib/Bucket/libBucket.a \ $(top_builddir)/Lib/Math/libMath.a \ $(top_builddir)/Lib/Misc/libMisc.a \ diff --git a/Main/construct.cxx b/Main/construct.cxx index 815a799e3..2857b3a75 100644 --- a/Main/construct.cxx +++ b/Main/construct.cxx @@ -32,8 +32,10 @@ #include -// load regular grid of elevation data (dem based) +// load regular grid of elevation data (dem based), return list of +// fitted nodes int load_dem(const string& work_base, FGBucket& b, FGArray& array) { + fitnode_list result; char tile_name[256]; string base = b.gen_base_path(); long int b_index = b.gen_index(); @@ -44,8 +46,10 @@ int load_dem(const string& work_base, FGBucket& b, FGArray& array) { cout << "dem_path = " << dem_path << endl; if ( ! array.open(dem_path) ) { + cout << "ERROR: cannot open " << dem_path << endl; return 0; } + array.parse(); array.fit( 100 ); @@ -133,21 +137,26 @@ int load_polys( const string& work_base, FGBucket& b, FGClipper& clipper) { // triangulate the data for each polygon -void triangulate( const FGArray& array, const FGClipper& clipper, +void do_triangulate( const FGArray& array, const FGClipper& clipper, FGTriangle& t ) { - // first we need to consolidate the points of all the polygons - // into a more "Triangle" friendly format - FGgpcPolyList gpc_polys; + // first we need to consolidate the points of the DEM fit list and + // all the polygons into a more "Triangle" friendly format - gpc_polys = clipper.get_polys_clipped(); + fitnode_list fit_list = array.get_fit_node_list(); + FGgpcPolyList gpc_polys = clipper.get_polys_clipped(); cout << "ready to build node list and polygons" << endl; - t.build( gpc_polys ); + t.build( fit_list, gpc_polys ); cout << "done building node list and polygons" << endl; + + cout << "ready to do triangulation" << endl; + t.run_triangulate(); + cout << "finished triangulation" << endl; } main(int argc, char **argv) { + fitnode_list fit_list; double lon, lat; if ( argc != 2 ) { @@ -173,11 +182,15 @@ main(int argc, char **argv) { // triangulate the data for each polygon FGTriangle t; - triangulate( array, clipper, t ); + do_triangulate( array, clipper, t ); } // $Log$ +// Revision 1.4 1999/03/20 20:32:54 curt +// First mostly successful tile triangulation works. There's plenty of tweaking +// to do, but we are marching in the right direction. +// // Revision 1.3 1999/03/19 00:26:52 curt // Minor tweaks ... // diff --git a/Triangulate/triangle.cxx b/Triangulate/triangle.cxx index 6db46c16c..ad03d3eb1 100644 --- a/Triangulate/triangle.cxx +++ b/Triangulate/triangle.cxx @@ -25,7 +25,6 @@ #include "triangle.hxx" #include "tripoly.hxx" - // Constructor FGTriangle::FGTriangle( void ) { } @@ -37,11 +36,23 @@ FGTriangle::~FGTriangle( void ) { // populate this class based on the specified gpc_polys list -int FGTriangle::build( const FGgpcPolyList& gpc_polys ) { +int +FGTriangle::build( const fitnode_list& fit_list, + const FGgpcPolyList& gpc_polys ) +{ int index; - // 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) + + // traverse the dem fit list and gpc_polys building a unified node + // list and converting the polygons so that they reference the + // node list by index (starting at zero) rather than listing the + // points explicitely + + const_fitnode_list_iterator f_current, f_last; + f_current = fit_list.begin(); + f_last = fit_list.end(); + for ( ; f_current != f_last; ++f_current ) { + index = trinodes.unique_add( *f_current ); + } gpc_polygon *gpc_poly; const_gpcpoly_iterator current, last; @@ -67,7 +78,7 @@ int FGTriangle::build( const FGgpcPolyList& gpc_polys ) { if (gpc_poly->num_contours > 1 ) { cout << "FATAL ERROR! no multi-contour support" << endl; - sleep(5); + sleep(2); // exit(-1); } @@ -93,30 +104,31 @@ int FGTriangle::build( const FGgpcPolyList& gpc_polys ) { << polylist[i].size() << endl; } } - return 0; -} + // traverse the polygon lists and build the segment (edge) list + // that is used by the "Triangle" lib. -// do actual triangulation -int FGTriangle::do_triangulate( const FGTriPoly& poly ) { - trinode_list node_list; - struct triangulateio in, out; - int counter; + FGTriPoly poly; + int i1, i2; + for ( int i = 0; i < FG_MAX_AREA_TYPES; ++i ) { + cout << "area type = " << i << endl; + tripoly_list_iterator tp_current, tp_last; + tp_current = polylist[i].begin(); + tp_last = polylist[i].end(); - // define input points - node_list = trinodes.get_node_list(); + // process each polygon in list + for ( ; tp_current != tp_last; ++tp_current ) { + poly = *tp_current; - in.numberofpoints = node_list.size(); - in.numberofpointattributes = 0; - in.pointlist = (REAL *) malloc(in.numberofpoints * 2 * sizeof(REAL)); - - trinode_list_iterator current, last; - current = node_list.begin(); - last = node_list.end(); - counter = 0; - for ( ; current != last; ++current ) { - in.pointlist[counter++] = current->x(); - in.pointlist[counter++] = current->y(); + for ( int j = 0; j < (int)(poly.size()) - 1; ++j ) { + i1 = poly.get_pt_index( j ); + i2 = poly.get_pt_index( j + 1 ); + trisegs.unique_add( FGTriSeg(i1, i2) ); + } + i1 = poly.get_pt_index( 0 ); + i2 = poly.get_pt_index( poly.size() - 1 ); + trisegs.unique_add( FGTriSeg(i1, i2) ); + } } return 0; @@ -124,72 +136,175 @@ int FGTriangle::do_triangulate( const FGTriPoly& poly ) { // triangulate each of the polygon areas -int FGTriangle::triangulate() { +int FGTriangle::run_triangulate() { FGTriPoly poly; - struct triangulateio in, out; - - trinode_list node_list = trinodes.get_node_list(); + Point3D p; + struct triangulateio in, out, vorout; + int counter; // point list + trinode_list node_list = trinodes.get_node_list(); in.numberofpoints = node_list.size(); - in.numberofpointattributes = 1; in.pointlist = (REAL *) malloc(in.numberofpoints * 2 * sizeof(REAL)); trinode_list_iterator tn_current, tn_last; tn_current = node_list.begin(); tn_last = node_list.end(); - int counter = 0; + counter = 0; for ( ; tn_current != tn_last; ++tn_current ) { in.pointlist[counter++] = tn_current->x(); in.pointlist[counter++] = tn_current->y(); } - in.pointattributelist = (REAL *) NULL; - in.pointmarkerlist = (int *) NULL; + in.numberofpointattributes = 1; + in.pointattributelist = (REAL *) malloc(in.numberofpoints * + in.numberofpointattributes * + sizeof(REAL)); + for ( int i = 0; i < in.numberofpoints * in.numberofpointattributes; i++) { + in.pointattributelist[i] = 0.0; + } + + in.pointmarkerlist = (int *) malloc(in.numberofpoints * sizeof(int)); + for ( int i = 0; i < in.numberofpoints; i++) { + in.pointmarkerlist[i] = 0; + } // segment list - in.numberofsegments = 0; + triseg_list seg_list = trisegs.get_seg_list(); + in.numberofsegments = seg_list.size(); + in.segmentlist = (int *) malloc(in.numberofsegments * 2 * sizeof(int)); - tripoly_list_iterator tp_current, tp_last; + triseg_list_iterator s_current, s_last; + s_current = seg_list.begin(); + s_last = seg_list.end(); + counter = 0; + for ( ; s_current != s_last; ++s_current ) { + in.segmentlist[counter++] = s_current->get_n1(); + in.segmentlist[counter++] = s_current->get_n2(); + } + + // hole list (make holes for airport ignore areas) + in.numberofholes = polylist[(int)AirportIgnoreArea].size(); + in.holelist = (REAL *) malloc(in.numberofholes * 2 * sizeof(REAL)); + + tripoly_list_iterator h_current, h_last; + h_current = polylist[(int)AirportIgnoreArea].begin(); + h_last = polylist[(int)AirportIgnoreArea].end(); + counter = 0; + for ( ; h_current != h_last; ++h_current ) { + poly = *h_current; + p = poly.get_point_inside(); + in.holelist[counter++] = p.x(); + in.holelist[counter++] = p.y(); + } + + // region list + in.numberofregions = 0; for ( int i = 0; i < FG_MAX_AREA_TYPES; ++i ) { - cout << "area type = " << i << endl; - tp_current = polylist[i].begin(); - tp_last = polylist[i].end(); - for ( ; tp_current != tp_last; ++tp_current ) { - poly = *tp_current; - in.numberofsegments += poly.size() + 1; + in.numberofregions += polylist[i].size(); + } + + in.regionlist = (REAL *) malloc(in.numberofregions * 4 * sizeof(REAL)); + for ( int i = 0; i < FG_MAX_AREA_TYPES; ++i ) { + tripoly_list_iterator h_current, h_last; + h_current = polylist[(int)AirportIgnoreArea].begin(); + h_last = polylist[(int)AirportIgnoreArea].end(); + counter = 0; + for ( ; h_current != h_last; ++h_current ) { + poly = *h_current; + p = poly.get_point_inside(); + in.regionlist[counter++] = p.x(); // x coord + in.regionlist[counter++] = p.y(); // y coord + in.regionlist[counter++] = i; // region attribute + in.regionlist[counter++] = -1.0; // area constraint (unused) } } - in.numberofsegments = 0; + // prep the output structures + out.pointlist = (REAL *) NULL; // Not needed if -N switch used. + // Not needed if -N switch used or number of point attributes is zero: + out.pointattributelist = (REAL *) NULL; + out.pointmarkerlist = (int *) NULL; // Not needed if -N or -B switch used. + out.trianglelist = (int *) NULL; // Not needed if -E switch used. + // Not needed if -E switch used or number of triangle attributes is zero: + out.triangleattributelist = (REAL *) NULL; + out.neighborlist = (int *) NULL; // Needed only if -n switch used. + // Needed only if segments are output (-p or -c) and -P not used: + out.segmentlist = (int *) NULL; + // Needed only if segments are output (-p or -c) and -P and -B not used: + out.segmentmarkerlist = (int *) NULL; + out.edgelist = (int *) NULL; // Needed only if -e switch used. + out.edgemarkerlist = (int *) NULL; // Needed if -e used and -B not used. + + vorout.pointlist = (REAL *) NULL; // Needed only if -v switch used. + // Needed only if -v switch used and number of attributes is not zero: + vorout.pointattributelist = (REAL *) NULL; + vorout.edgelist = (int *) NULL; // Needed only if -v switch used. + vorout.normlist = (REAL *) NULL; // Needed only if -v switch used. + + // Triangulate the points. Switches are chosen to read and write + // a PSLG (p), preserve the convex hull (c), number everything + // from zero (z), assign a regional attribute to each element (A), + // and produce an edge list (e), and a triangle neighbor list (n). - in.numberofholes = 0; - in.numberofregions = 1; - in.regionlist = (REAL *) malloc(in.numberofregions * 4 * sizeof(REAL)); - in.regionlist[0] = 0.5; - in.regionlist[1] = 5.0; - in.regionlist[2] = 7.0; /* Regional attribute (for whole mesh). */ - in.regionlist[3] = 0.1; /* Area constraint that will not be used. */ + triangulate("pczAen", &in, &out, &vorout); - /* - tripoly_list_iterator current, last; - for ( int i = 0; i < FG_MAX_AREA_TYPES; ++i ) { - cout << "area type = " << i << endl; - current = polylist[i].begin(); - last = polylist[i].end(); - for ( ; current != last; ++current ) { - poly = *current; - cout << "triangulating a polygon, size = " << poly.size() << endl; + // TEMPORARY + // - do_triangulate( poly ); - } + // Write out the triangulated data to files so we can check + // visually that things seem reasonable + + FILE *node = fopen("tile.node", "w"); + fprintf(node, "%d 2 %d 0\n", + out.numberofpoints, out.numberofpointattributes); + for (int i = 0; i < out.numberofpoints; i++) { + fprintf(node, "%d %.6f %.6f %.2f\n", + i, out.pointlist[2*i], out.pointlist[2*i + 1], 0.0); } - */ + fclose(node); + + FILE *ele = fopen("tile.ele", "w"); + fprintf(ele, "%d 3 0\n", out.numberoftriangles); + for (int i = 0; i < out.numberoftriangles; i++) { + fprintf(ele, "%d ", i); + for (int j = 0; j < out.numberofcorners; j++) { + fprintf(ele, "%d ", out.trianglelist[i * out.numberofcorners + j]); + } + fprintf(ele, "\n"); + } + fclose(ele); + + // free mem allocated to the "Triangle" structures + free(in.pointlist); + free(in.pointattributelist); + free(in.pointmarkerlist); + free(in.regionlist); + free(out.pointlist); + free(out.pointattributelist); + free(out.pointmarkerlist); + free(out.trianglelist); + free(out.triangleattributelist); + // free(out.trianglearealist); + free(out.neighborlist); + free(out.segmentlist); + free(out.segmentmarkerlist); + free(out.edgelist); + free(out.edgemarkerlist); + free(vorout.pointlist); + free(vorout.pointattributelist); + free(vorout.edgelist); + free(vorout.normlist); + return 0; } // $Log$ +// Revision 1.7 1999/03/20 20:32:55 curt +// First mostly successful tile triangulation works. There's plenty of tweaking +// to do, but we are marching in the right direction. +// // Revision 1.6 1999/03/20 13:22:11 curt // Added trisegs.[ch]xx tripoly.[ch]xx. // diff --git a/Triangulate/triangle.hxx b/Triangulate/triangle.hxx index 58fa1bd26..0a115fd73 100644 --- a/Triangulate/triangle.hxx +++ b/Triangulate/triangle.hxx @@ -35,6 +35,7 @@ #include +#include #include #include #include @@ -46,6 +47,7 @@ extern "C" { #include "trinodes.hxx" #include "tripoly.hxx" +#include "trisegs.hxx" FG_USING_STD(vector); @@ -59,9 +61,15 @@ class FGTriangle { private: + // list of nodes FGTriNodes trinodes; - tripoly_list polylist[FG_MAX_AREA_TYPES]; + // list of segments + FGTriSegments trisegs; + + // polygon list + tripoly_list polylist[FG_MAX_AREA_TYPES]; + public: // Constructor and destructor @@ -72,13 +80,10 @@ public: int add_nodes(); // populate this class based on the specified gpc_polys list - int build( const FGgpcPolyList& gpc_polys ); - - // do actual triangulation - int do_triangulate( const FGTriPoly& poly ); + int build( const fitnode_list& fit_list, const FGgpcPolyList& gpc_polys ); // front end triangulator for polygon list - int triangulate(); + int run_triangulate(); }; @@ -86,6 +91,10 @@ public: // $Log$ +// Revision 1.6 1999/03/20 20:32:56 curt +// First mostly successful tile triangulation works. There's plenty of tweaking +// to do, but we are marching in the right direction. +// // Revision 1.5 1999/03/20 02:21:53 curt // Continue shaping the code towards triangulation bliss. Added code to // calculate some point guaranteed to be inside a polygon. diff --git a/Triangulate/tripoly.hxx b/Triangulate/tripoly.hxx index 92986247c..73a5e8338 100644 --- a/Triangulate/tripoly.hxx +++ b/Triangulate/tripoly.hxx @@ -64,9 +64,13 @@ public: // return size inline int size() const { return poly.size(); } + // return the ith polygon point index + inline int get_pt_index( int i ) const { return poly[i]; } + // calculate an "arbitrary" point inside this polygon for // assigning attribute areas void calc_point_inside( const FGTriNodes& trinodes ); + inline Point3D get_point_inside() const { return inside; } }; @@ -74,6 +78,10 @@ public: // $Log$ +// Revision 1.2 1999/03/20 20:32:58 curt +// First mostly successful tile triangulation works. There's plenty of tweaking +// to do, but we are marching in the right direction. +// // Revision 1.1 1999/03/20 13:21:36 curt // Initial revision. // diff --git a/Triangulate/trisegs.cxx b/Triangulate/trisegs.cxx index 55853e6ce..d3ce0eec1 100644 --- a/Triangulate/trisegs.cxx +++ b/Triangulate/trisegs.cxx @@ -25,7 +25,48 @@ #include "trisegs.hxx" +// Constructor +FGTriSegments::FGTriSegments( void ) { +} + + +// Destructor +FGTriSegments::~FGTriSegments( void ) { +} + + +// Add a point to the point list if it doesn't already exist. +// Returns the index (starting at zero) of the point in the list. +int FGTriSegments::unique_add( const FGTriSeg& s ) { + triseg_list_iterator current, last; + int counter = 0; + + cout << s.get_n1() << "," << s.get_n2() << endl; + + // see if point already exists + current = seg_list.begin(); + last = seg_list.end(); + for ( ; current != last; ++current ) { + if ( s == *current ) { + cout << "found an existing segment match" << endl; + return counter; + } + + ++counter; + } + + // add to list + seg_list.push_back( s ); + + return counter; +} + + // $Log$ +// Revision 1.2 1999/03/20 20:32:59 curt +// First mostly successful tile triangulation works. There's plenty of tweaking +// to do, but we are marching in the right direction. +// // Revision 1.1 1999/03/20 13:21:36 curt // Initial revision. // diff --git a/Triangulate/trisegs.hxx b/Triangulate/trisegs.hxx index 534b694f5..31189d591 100644 --- a/Triangulate/trisegs.hxx +++ b/Triangulate/trisegs.hxx @@ -40,10 +40,31 @@ FG_USING_STD(vector); // a segment is two integer pointers into the node list class FGTriSeg { -public: int n1, n2; + +public: + + // Constructor and destructor + inline FGTriSeg( void ) { }; + inline FGTriSeg( int i1, int i2 ) { n1 = i1; n2 = i2; } + + inline ~FGTriSeg( void ) { }; + + inline int get_n1() const { return n1; } + inline void set_n1( int i ) { n1 = i; } + inline int get_n2() const { return n2; } + inline void set_n2( int i ) { n2 = i; } + + friend bool operator == (const FGTriSeg& a, const FGTriSeg& b); + }; +inline bool operator == (const FGTriSeg& a, const FGTriSeg& b) +{ + return ((a.n1 == b.n1) && (a.n2 == b.n2)) + || ((a.n1 == b.n2) && (a.n2 == b.n1)); +} + typedef vector < FGTriSeg > triseg_list; typedef triseg_list::iterator triseg_list_iterator; @@ -78,6 +99,10 @@ public: // $Log$ +// Revision 1.2 1999/03/20 20:33:00 curt +// First mostly successful tile triangulation works. There's plenty of tweaking +// to do, but we are marching in the right direction. +// // Revision 1.1 1999/03/20 13:21:36 curt // Initial revision. //