Discussion:
[Flightgear-devel] genapts850 hangs on some airports from "the gateway"
Torsten Dreyer
2017-07-20 19:43:23 UTC
Permalink
Hi,

while slowly proceeding with a pipelined world scenery build [1][2], I
noticed that genapts850 hangs while processing certain airports from the
x-plane gateway (e.g. SBFN)
I found the culprit in some airports having many, very small "linear
features", usually white lines. Thoses features are usually polygons, as
small as a few square meters.
For some reason the tgAccumulator::Diff method hangs while clipping
intersecting polygons. Thats eventually because of our snapping to a grid.

For now, I decided to simply drop polygons of linear features that are too
small. Small means "less than 5 meters from the south-western corner to the
north-eastern corner".

Following is the patch for linearfeature.cxx - this seems to let genapts
proceed a bit further.
My git clone of the terragear with a few hacky patches to make the tools
usable (again) is at
https://sourceforge.net/u/torstendreyer/t3r-terragear/ci/t3r/tree/
I am not very familiar with the genapts process - maybe somebody with more
knowledge can comment on this?

----------------------------------------------------------------
commit f43396c8ea7f2167472813ad90dbcba4338b5e7b
Author: Torsten Dreyer <***@t3r.de>
Date: Thu Jul 20 20:53:39 2017 +0200

drop small linear feature polys

try fix a hang of genapts850 for very small linear features

diff --git a/src/Airports/GenAirports850/linearfeature.cxx
b/src/Airports/GenAirports850/linearfeature.cxx
index fe5bdcf..884a2a7 100644
--- a/src/Airports/GenAirports850/linearfeature.cxx
+++ b/src/Airports/GenAirports850/linearfeature.cxx
@@ -548,9 +548,14 @@ int LinearFeature::Finish( bool closed, unsigned int
idx )
poly.SetTexParams( prev_inner, width, 1.0f, heading );
poly.SetTexLimits( 0, last_end_v, 1, 1 );
poly.SetTexMethod( TG_TEX_BY_TPS_CLIPU, -1.0, 0.0, 1.0,
0.0 );
- marking_polys.push_back(poly);
+ tgRectangle box1 = poly.GetBoundingBox();
+ if( SGGeodesy::distanceM( box1.getMin(), box1.getMax() ) >
5 ) {
+ marking_polys.push_back(poly);
+ last_end_v = (double)1.0f - (fmod( (double)(dist -
last_end_v), (double)1.0f ));
+ } else {
+ SG_LOG(SG_ALL,SG_ALERT, "dropping small poly " );
+ }

- last_end_v = (double)1.0f - (fmod( (double)(dist -
last_end_v), (double)1.0f ));
} else {
markStarted = true;
}
----------------------------------------------------------------

[1] https://scenery.flightgear.org/jenkins/job/Scenery/job/worldscenery/
[2]
https://sourceforge.net/u/torstendreyer/FGSceneryPipes/ci/worldscenery/tree/
--
Torsten Dreyer
Loading...