From bbae3a98a6288dfd8bd0306440cf023f0129b5af Mon Sep 17 00:00:00 2001 From: Frederic Bouvier Date: Sat, 2 Oct 2010 10:25:36 +0200 Subject: [PATCH] Better fix by Geoff McLane --- src/BuildTiles/GenOutput/genobj.cxx | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/BuildTiles/GenOutput/genobj.cxx b/src/BuildTiles/GenOutput/genobj.cxx index a8f80d2e..aa1fa87e 100644 --- a/src/BuildTiles/GenOutput/genobj.cxx +++ b/src/BuildTiles/GenOutput/genobj.cxx @@ -147,7 +147,7 @@ int_list TGGenOutput::calc_tex_coords( TGConstruct& c, point_list geod_nodes, // build the necessary output structures based on the triangulation // data int TGGenOutput::build( TGConstruct& c ) { - int i, j; + int i, j, k; TGTriNodes trinodes = c.get_tri_nodes(); @@ -183,7 +183,11 @@ int TGGenOutput::build( TGConstruct& c ) { cout << "calculating texture coordinates" << endl; cout << "c.get_useUKGrid() = " << c.get_useUKGrid() << endl; tex_coords.clear(); - + std::vector < SGGeod > convGeodNodes; + for ( k = 0; k < geod_nodes.size(); k++ ) { + Point3D node = geod_nodes[k]; + convGeodNodes.push_back( SGGeod::fromDegM( node.x(), node.y(), node.z() ) ); + } for ( i = 0; i < TG_MAX_AREA_TYPES; ++i ) { // cout << " area = " << i << endl; for ( j = 0; j < (int)fans[i].size(); ++j ) { @@ -203,18 +207,12 @@ int TGGenOutput::build( TGConstruct& c ) { if( (c.get_useUKGrid()) && (isInUK(ourPosition)) ) { point_list tp_list; tp_list = UK_calc_tex_coords( b, geod_nodes, fans[i][j], 1.0 ); - for ( int k = 0; k < (int)tp_list.size(); ++k ) { + for ( k = 0; k < (int)tp_list.size(); ++k ) { // cout << " tc = " << tp_list[k] << endl; int index = tex_coords.simple_add( tp_list[k] ); ti_list.push_back( index ); } } else { - int k; - std::vector < SGGeod > convGeodNodes; - for ( k = 0; k < geod_nodes.size(); k++ ) { - Point3D node = geod_nodes[k]; - convGeodNodes.push_back( SGGeod::fromDegM( node.x(), node.y(), node.z() ) ); - } std::vector< SGVec2f > tp_list = sgCalcTexCoords( b, convGeodNodes, fans[i][j] ); for ( k = 0; k < (int)tp_list.size(); ++k ) { SGVec2f tc = tp_list[k]; @@ -236,7 +234,7 @@ int TGGenOutput::build( TGConstruct& c ) { } -// caclulate the bounding sphere for a list of triangle faces +// calculate the bounding sphere for a list of triangle faces void TGGenOutput::calc_group_bounding_sphere( TGConstruct& c, const opt_list& fans, Point3D *center, double *radius )