From fc6eee819bb8d05c4958ff2c104ee6bf71457761 Mon Sep 17 00:00:00 2001 From: curt Date: Mon, 29 Mar 1999 13:11:00 +0000 Subject: [PATCH] Shuffled stl type names a bit. Began adding support for tri-fanning (or maybe other arrangments too.) --- Array/Makefile.am | 5 ++++- Array/array.hxx | 19 ++++++++++--------- Construct/Makefile.am | 1 + GenOutput/genobj.cxx | 16 ++++++++++++---- GenOutput/genobj.hxx | 16 +++++++++++----- Main/Makefile.am | 3 ++- Main/construct.cxx | 21 +++++++++++++-------- Triangulate/triangle.cxx | 14 +++++++++----- Triangulate/triangle.hxx | 8 ++++++-- Triangulate/trinodes.hxx | 13 +++++-------- Triangulate/tripoly.cxx | 6 +++++- Triangulate/tripoly.hxx | 13 +++++++------ Triangulate/trisegs.cxx | 6 +++++- 13 files changed, 90 insertions(+), 51 deletions(-) diff --git a/Array/Makefile.am b/Array/Makefile.am index 8f9897423..a62648005 100644 --- a/Array/Makefile.am +++ b/Array/Makefile.am @@ -13,7 +13,10 @@ testarray_LDADD = \ $(top_builddir)/Lib/Misc/libMisc.a \ $(top_builddir)/Lib/zlib/libz.a -INCLUDES += -I$(top_builddir) -I$(top_builddir)/Lib +INCLUDES += \ + -I$(top_builddir) \ + -I$(top_builddir)/Lib \ + -I$(top_builddir)/Tools/Construct # We can't build this with "-O2" (optimization) since this causes a seg fault # I haven't found a way to strip this out of the CXXFLAGS, so I'm just diff --git a/Array/array.hxx b/Array/array.hxx index ee3c8a37b..601d0fb56 100644 --- a/Array/array.hxx +++ b/Array/array.hxx @@ -39,6 +39,8 @@ #include #include +#include
+ FG_USING_STD(vector); @@ -46,11 +48,6 @@ FG_USING_STD(vector); #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: @@ -73,8 +70,8 @@ private: // float (*out_data)[ARRAY_SIZE_1]; // output nodes - fitnode_list corner_list; - fitnode_list node_list; + point_list corner_list; + point_list node_list; public: @@ -116,8 +113,8 @@ public: inline double get_col_step() const { return col_step; } inline double get_row_step() const { return row_step; } - inline fitnode_list get_corner_node_list() const { return corner_list; } - inline fitnode_list get_fit_node_list() const { return node_list; } + inline point_list get_corner_node_list() const { return corner_list; } + inline point_list get_fit_node_list() const { return node_list; } }; @@ -125,6 +122,10 @@ public: // $Log$ +// Revision 1.5 1999/03/29 13:11:02 curt +// Shuffled stl type names a bit. +// Began adding support for tri-fanning (or maybe other arrangments too.) +// // Revision 1.4 1999/03/27 05:20:14 curt // Handle corner nodes separately from the rest of the fitted nodes. // Fixed some "const" related warnings. diff --git a/Construct/Makefile.am b/Construct/Makefile.am index d3901496a..7761fd464 100644 --- a/Construct/Makefile.am +++ b/Construct/Makefile.am @@ -1,6 +1,7 @@ SUBDIRS = \ Array \ Clipper \ + GenFans \ GenOutput \ Triangulate \ Main diff --git a/GenOutput/genobj.cxx b/GenOutput/genobj.cxx index d45a649ba..ad2446d07 100644 --- a/GenOutput/genobj.cxx +++ b/GenOutput/genobj.cxx @@ -64,7 +64,7 @@ void FGGenOutput::gen_wgs84_points( const FGArray& array ) { // is an entry for each point containing a list of all the triangles // that share that point. void FGGenOutput::gen_node_ele_lookup_table() { - belongs_to ele_list; + int_list ele_list; ele_list.erase( ele_list.begin(), ele_list.end() ); // initialize reverse_ele_lookup structure by creating an empty @@ -128,10 +128,10 @@ void FGGenOutput::gen_normals() { // for each node for ( int i = 0; i < (int)wgs84_nodes.size(); ++i ) { - belongs_to tri_list = reverse_ele_lookup[i]; + int_list tri_list = reverse_ele_lookup[i]; - belongs_to_iterator current = tri_list.begin(); - belongs_to_iterator last = tri_list.end(); + int_list_iterator current = tri_list.begin(); + int_list_iterator last = tri_list.end(); Point3D average( 0.0 ); @@ -190,6 +190,10 @@ int FGGenOutput::build( const FGArray& array, const FGTriangle& t ) { // copy the triangle list into this class tri_elements = t.get_elelist(); + // build the trifan list + FGGenFans f; + fans = f.greedy_build( tri_elements ); + // generate the point list in wgs-84 coordinates gen_wgs84_points( array ); @@ -400,6 +404,10 @@ int FGGenOutput::write( const string& base, const FGBucket& b ) { // $Log$ +// Revision 1.6 1999/03/29 13:11:03 curt +// Shuffled stl type names a bit. +// Began adding support for tri-fanning (or maybe other arrangments too.) +// // Revision 1.5 1999/03/27 14:06:42 curt // Tweaks to bounding sphere calculation routines. // Group like triangles together for output to be in a single display list, diff --git a/GenOutput/genobj.hxx b/GenOutput/genobj.hxx index 2d89fbe66..7d2d84374 100644 --- a/GenOutput/genobj.hxx +++ b/GenOutput/genobj.hxx @@ -39,17 +39,16 @@ #include #include #include + +#include +#include
#include FG_USING_STD(string); FG_USING_STD(vector); -typedef vector < int > belongs_to; -typedef belongs_to::iterator belongs_to_iterator; -typedef belongs_to::const_iterator belongs_to_tripoly_iterator; - -typedef vector < belongs_to > belongs_to_list; +typedef vector < int_list > belongs_to_list; typedef belongs_to_list::iterator belongs_to_list_iterator; typedef belongs_to_list::const_iterator belongs_to_list_tripoly_iterator; @@ -74,6 +73,9 @@ private: // triangles (by index into point list) triele_list tri_elements; + // fan list + fan_list fans; + // for each node, a list of triangle indices that contain this node belongs_to_list reverse_ele_lookup; @@ -129,6 +131,10 @@ public: // $Log$ +// Revision 1.7 1999/03/29 13:11:04 curt +// Shuffled stl type names a bit. +// Began adding support for tri-fanning (or maybe other arrangments too.) +// // Revision 1.6 1999/03/27 14:06:43 curt // Tweaks to bounding sphere calculation routines. // Group like triangles together for output to be in a single display list, diff --git a/Main/Makefile.am b/Main/Makefile.am index 06acce5b2..ffc387243 100644 --- a/Main/Makefile.am +++ b/Main/Makefile.am @@ -1,11 +1,12 @@ bin_PROGRAMS = construct -construct_SOURCES = construct.cxx +construct_SOURCES = construct.cxx construct_types.hxx construct_LDADD = \ $(top_builddir)/Tools/Construct/Array/libArray.a \ $(top_builddir)/Tools/Construct/Clipper/libClipper.a \ $(top_builddir)/Tools/Construct/GenOutput/libGenOutput.a \ + $(top_builddir)/Tools/Construct/GenFans/libGenFans.a \ $(top_builddir)/Tools/Construct/Triangulate/libTriangulate.a \ $(top_builddir)/Tools/Lib/Polygon/libPolygon.a \ $(top_builddir)/Tools/Lib/Triangle/libTriangle.a \ diff --git a/Main/construct.cxx b/Main/construct.cxx index fb0d76f0f..92b853b45 100644 --- a/Main/construct.cxx +++ b/Main/construct.cxx @@ -37,7 +37,7 @@ // 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; + point_list result; string base = b.gen_base_path(); string dem_path = work_base + ".dem" + "/Scenery/" + base @@ -138,8 +138,8 @@ void do_triangulate( const FGArray& array, const FGClipper& clipper, // first we need to consolidate the points of the DEM fit list and // all the polygons into a more "Triangle" friendly format - fitnode_list corner_list = array.get_corner_node_list(); - fitnode_list fit_list = array.get_fit_node_list(); + point_list corner_list = array.get_corner_node_list(); + point_list fit_list = array.get_fit_node_list(); FGgpcPolyList gpc_polys = clipper.get_polys_clipped(); cout << "ready to build node list and polygons" << endl; @@ -184,7 +184,6 @@ void construct_tile( const string& work_base, const string& output_base, main(int argc, char **argv) { - fitnode_list fit_list; double lon, lat; fglog().setLogLevels( FG_ALL, FG_DEBUG ); @@ -204,16 +203,18 @@ main(int argc, char **argv) { // lon = -89.744682312011719; lat= 29.314495086669922; // lon = -122.488090; lat = 42.743183; // 64S // 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 double min_x = lon - 1; double min_y = lat - 1; FGBucket b_min( min_x, min_y ); FGBucket b_max( lon + 1, lat + 1 ); - // FGBucket b(550363L); - // construct_tile( work_base, output_base, b ); - // exit(0); + // FGBucket b(533955L); + 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 ); @@ -237,6 +238,10 @@ main(int argc, char **argv) { // $Log$ +// Revision 1.11 1999/03/29 13:11:06 curt +// Shuffled stl type names a bit. +// Began adding support for tri-fanning (or maybe other arrangments too.) +// // Revision 1.10 1999/03/27 05:25:02 curt // Fit with a value of 200 rather than 100. // Handle corner nodes separately from the rest of the fitted nodes. diff --git a/Triangulate/triangle.cxx b/Triangulate/triangle.cxx index 5aa396721..dba74d102 100644 --- a/Triangulate/triangle.cxx +++ b/Triangulate/triangle.cxx @@ -37,8 +37,8 @@ FGTriangle::~FGTriangle( void ) { // populate this class based on the specified gpc_polys list int -FGTriangle::build( const fitnode_list& corner_list, - const fitnode_list& fit_list, +FGTriangle::build( const point_list& corner_list, + const point_list& fit_list, const FGgpcPolyList& gpc_polys ) { FGTriPoly poly; @@ -55,7 +55,7 @@ FGTriangle::build( const fitnode_list& corner_list, // listing the points explicitely // first the corners since these are important - const_fitnode_list_iterator f_current, f_last; + const_point_list_iterator f_current, f_last; f_current = corner_list.begin(); f_last = corner_list.end(); for ( ; f_current != f_last; ++f_current ) { @@ -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,10 @@ int FGTriangle::run_triangulate() { // $Log$ +// Revision 1.13 1999/03/29 13:11:07 curt +// Shuffled stl type names a bit. +// Began adding support for tri-fanning (or maybe other arrangments too.) +// // Revision 1.12 1999/03/27 05:30:12 curt // Handle corner nodes separately from the rest of the fitted nodes. // Add fitted nodes in after corners and polygon nodes since the fitted nodes diff --git a/Triangulate/triangle.hxx b/Triangulate/triangle.hxx index 8106c3ab3..b561bd2c1 100644 --- a/Triangulate/triangle.hxx +++ b/Triangulate/triangle.hxx @@ -76,8 +76,8 @@ public: int add_nodes(); // populate this class based on the specified gpc_polys list - int build( const fitnode_list& corner_list, - const fitnode_list& fit_list, + int build( const point_list& corner_list, + const point_list& fit_list, const FGgpcPolyList& gpc_polys ); // front end triangulator for polygon list @@ -92,6 +92,10 @@ public: // $Log$ +// Revision 1.10 1999/03/29 13:11:08 curt +// Shuffled stl type names a bit. +// Began adding support for tri-fanning (or maybe other arrangments too.) +// // Revision 1.9 1999/03/27 05:30:13 curt // Handle corner nodes separately from the rest of the fitted nodes. // Add fitted nodes in after corners and polygon nodes since the fitted nodes diff --git a/Triangulate/trinodes.hxx b/Triangulate/trinodes.hxx index 860b63034..6b05a42df 100644 --- a/Triangulate/trinodes.hxx +++ b/Triangulate/trinodes.hxx @@ -33,22 +33,15 @@ #include -#include - #include -FG_USING_STD(vector); +#include
#define FG_PROXIMITY_EPSILON 0.000001 #define FG_COURSE_EPSILON 0.0003 -typedef vector < Point3D > point_list; -typedef point_list::iterator point_list_iterator; -typedef point_list::const_iterator const_point_list_iterator; - - class FGTriNodes { private: @@ -119,6 +112,10 @@ inline bool FGTriNodes::course_close_enough( const Point3D& p1, // $Log$ +// Revision 1.7 1999/03/29 13:11:10 curt +// Shuffled stl type names a bit. +// Began adding support for tri-fanning (or maybe other arrangments too.) +// // Revision 1.6 1999/03/27 05:30:16 curt // Handle corner nodes separately from the rest of the fitted nodes. // Add fitted nodes in after corners and polygon nodes since the fitted nodes diff --git a/Triangulate/tripoly.cxx b/Triangulate/tripoly.cxx index 763e369e4..d01bb8b40 100644 --- a/Triangulate/tripoly.cxx +++ b/Triangulate/tripoly.cxx @@ -95,7 +95,7 @@ void FGTriPoly::calc_point_inside( const FGTriNodes& trinodes ) { // int min_index; int min_node_index = 0; - tripoly_iterator current, last; + int_list_iterator current, last; current = poly.begin(); last = poly.end(); @@ -180,6 +180,10 @@ void FGTriPoly::calc_point_inside( const FGTriNodes& trinodes ) { // $Log$ +// Revision 1.2 1999/03/29 13:11:11 curt +// Shuffled stl type names a bit. +// Began adding support for tri-fanning (or maybe other arrangments too.) +// // Revision 1.1 1999/03/20 13:21:36 curt // Initial revision. // diff --git a/Triangulate/tripoly.hxx b/Triangulate/tripoly.hxx index 0cd87d00c..0e156dbae 100644 --- a/Triangulate/tripoly.hxx +++ b/Triangulate/tripoly.hxx @@ -35,21 +35,18 @@ #include +#include
+ #include "trinodes.hxx" FG_USING_STD(vector); -typedef vector < int > tripoly; -typedef tripoly::iterator tripoly_iterator; -typedef tripoly::const_iterator const_tripoly_iterator; - - class FGTriPoly { private: - tripoly poly; + int_list poly; Point3D inside; public: @@ -85,6 +82,10 @@ typedef tripoly_list::const_iterator const_tripoly_list_iterator; // $Log$ +// Revision 1.5 1999/03/29 13:11:12 curt +// Shuffled stl type names a bit. +// Began adding support for tri-fanning (or maybe other arrangments too.) +// // Revision 1.4 1999/03/23 22:02:56 curt // Refinements in naming and organization. // diff --git a/Triangulate/trisegs.cxx b/Triangulate/trisegs.cxx index 62cf4d03a..1c1c386bf 100644 --- a/Triangulate/trisegs.cxx +++ b/Triangulate/trisegs.cxx @@ -76,7 +76,7 @@ void FGTriSegments::unique_divide_and_add( const point_list& nodes, Point3D p1 = nodes[ s.get_n2() ]; bool found_extra = false; - int extra_index; + int extra_index = 0; int counter; double m, b, y_err, x_err; const_point_list_iterator current, last; @@ -170,6 +170,10 @@ void FGTriSegments::unique_divide_and_add( const point_list& nodes, // $Log$ +// 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.) +// // Revision 1.4 1999/03/27 05:30:17 curt // Handle corner nodes separately from the rest of the fitted nodes. // Add fitted nodes in after corners and polygon nodes since the fitted nodes -- 2.39.5