Re: Re: SRTM Eurasia
"Curtis L. Olson" <[email protected]>
| Newsgroups | gmane.games.flightgear.terragear.devel |
|---|---|
| Message-ID | <[email protected]> |
I believe the vpf code is David's so perhaps he should review it for correctness before we commit it to the repository? Curt. Alex Romosan writes: > "Curtis L. Olson" <[email protected]> writes: > > > For what it's worth, I have fetched all of the SRTM Eurasia data, > > chopped it, and now I am working on the terrafit stage. There is a > > lot of data here so it could take a couple days. > > last night i generated the e020n40 chunk and you can get it from > http://caliban.lbl.gov/fgfs/e020n40/. this is rather detailed as i ran > terrafit with a min number of nodes set to 250, max number of nodes to > 3000, and the max error set to 2. i had problems generating the Lakes > data from the vmap data. > > (running tgvpf --chunk=e020n40 --work-dir=Lakes --material=Lake /home/romosan/scenery/vmaplv0 eurnasia hydro inwatera). > > it looks like the program gets into an infinite loop while findind > edges for a contour (inserting the same edge over and over until the > program runs out of memory). i am not quite sure i understand the code > but the following patch solved the problem for me: > > RCS file: /var/cvs/TerraGear-0.0/TerraGear/src/Lib/vpf/contour.cxx,v > retrieving revision 1.1 > diff -u -r1.1 contour.cxx > --- contour.cxx 18 Sep 2001 21:17:48 -0000 1.1 > +++ contour.cxx 17 Dec 2003 20:40:49 -0000 > @@ -90,18 +91,32 @@ > previous_edge = current_edge; > if (edg.getValue(row, "right_face") > .getCrossRef().current_tile_key == _polygon_id) { > - info.isLR = true; > - current_edge = edg.getValue(row, "right_edge") > - .getCrossRef().current_tile_key; > + info.isLR = true; > + current_edge = edg.getValue(row, "right_edge") > + .getCrossRef().current_tile_key; > + if (edg.getValue(row, "left_face") > + .getCrossRef().current_tile_key == _polygon_id) > + std::cout << "right face also left face" << std::endl; > } else if (edg.getValue(row, "left_face") > - .getCrossRef().current_tile_key == _polygon_id) { > - info.isLR = false; > - current_edge = edg.getValue(row, "left_edge") > - .getCrossRef().current_tile_key; > + .getCrossRef().current_tile_key == _polygon_id) { > + info.isLR = false; > + current_edge = edg.getValue(row, "left_edge") > + .getCrossRef().current_tile_key; > } else { > throw VpfException("edge does not belong to face"); > } > > + for ( vector<line_info>::reverse_iterator it = _lines->rbegin(); > + it != _lines->rend(); it++ ) > + { > + if ( it->id == info.id ) > + { > + std::cout << "eeek!!! infinite loop..." << std::endl; > + _nPoints -= info.size; > + return *_lines; > + } > + } > + > _lines->push_back(info); > } while (current_edge != _start_edge); > } > > the reason i go back through the vector instead of just checking > against the last inserted edge is that there is one instance where the > edges repeat as a pair. trying to understand when this infinite loop > happens i realized that every time the infinite loop happens the edge > happens to be both right (which we check for first) and left. i am not > sure what this means though. i tried reversing the handedness of the > edge when this happens, but it didn't work reliably. obviously > something else is happening here. > > and while i am submitting patches, this is another one i applied: > > RCS file: /var/cvs/TerraGear-0.0/TerraGear/src/Lib/vpf/tile.cxx,v > retrieving revision 1.2 > diff -u -r1.2 tile.cxx > --- tile.cxx 7 Oct 2002 15:36:26 -0000 1.2 > +++ tile.cxx 17 Dec 2003 20:45:54 -0000 > @@ -12,11 +12,13 @@ > VpfTile::VpfTile (VpfTableManager &tableManager, > const string &path, int tile_id) > : VpfComponent(tableManager, path), > - _tile_id(tile_id), // FIXME: kludge > - _face_id(-1), > + _tile_id(tile_id), > _aft(0), > _fbr(0) > { > + const VpfTable &aft = getAFT(); > + int row = aft.findMatch("id", _tile_id); > + _face_id = aft.getValue(row, "fac_id").getInt(); > } > > VpfTile::VpfTile (const VpfTile &tile) > @@ -55,12 +57,6 @@ > VpfRectangle rect; > const VpfTable &fbr = getFBR(); > > - if (_face_id == -1) { > - const VpfTable &aft = getAFT(); > - int row = aft.findMatch("id", _tile_id); > - _face_id = aft.getValue(row, "fac_id").getInt(); > - } > - > int row = fbr.findMatch("id", _face_id); > rect.minX = fbr.getValue(row, "xmin").getReal(); > rect.minY = fbr.getValue(row, "ymin").getReal(); > > basically it moves the initialization of _face_id to the constructor > (where it belongs) and thus removes the ugly kludge. > > --alex-- > > -- > | I believe the moment is at hand when, by a paranoiac and active | > | advance of the mind, it will be possible (simultaneously with | > | automatism and other passive states) to systematize confusion | > | and thus to help to discredit completely the world of reality. | > > _______________________________________________ > Terragear-devel mailing list > [email protected] > http://mail.flightgear.org/mailman/listinfo/terragear-devel -- Curtis Olson HumanFIRST Program FlightGear Project Twin Cities curt 'at' me.umn.edu curt 'at' flightgear.org Minnesota http://www.flightgear.org/~curt http://www.flightgear.org