From 2dac4a87e5fbd5a6a71cdf82d1be1c170364942a Mon Sep 17 00:00:00 2001 From: Peter Sadrozinski Date: Mon, 6 Feb 2012 20:58:22 -0500 Subject: [PATCH] stability check - ran through the last commit, and only 10 airports crashed / locked up. - EICL, SSPK, and LFBT fix was to simplify the base polygon during cleaning reduce_degeneracy() could also be used to fix the issue 2 polygons clipped against each other shared a vertex. This causes the resulting contour to have a duplicate point with different line segments. Luckily, clipper's polygon simplification cleans this up by adding a hole contour. In the above airports, triangulation suceeded, but I'm not 100% convinced it will work for all cases. reduce_degeneracy() will, at the expense of modified geometry (very noticible) - EGLW and SWCH (I think - can't read my own writing) were fixed by expanding the user defined boundary by 2 meters for the base, and 5 meters for the clearing. These 2 airports had the user defined boundary touching the exact airport layout. When the base was diffed with the accumulation buffer, the resulting polygon was NIL. Starting a whole new stability test from the beginning to check for regressions. Down to 5 airports with isses left. --- src/Airports/GenAirports850/airport.cxx | 1 + src/Airports/GenAirports850/closedpoly.cxx | 15 +++++---------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/Airports/GenAirports850/airport.cxx b/src/Airports/GenAirports850/airport.cxx index 01ee99fa..cbfb2eff 100644 --- a/src/Airports/GenAirports850/airport.cxx +++ b/src/Airports/GenAirports850/airport.cxx @@ -723,6 +723,7 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src ) base_poly = remove_cycles( base_poly ); base_poly = remove_dups( base_poly ); base_poly = remove_bad_contours( base_poly ); + base_poly = tgPolygonSimplify( base_poly ); base_poly = remove_tiny_contours( base_poly ); base_poly = remove_spikes( base_poly ); base_poly = remove_dups( base_poly ); diff --git a/src/Airports/GenAirports850/closedpoly.cxx b/src/Airports/GenAirports850/closedpoly.cxx index 8763df26..fd8d7f6e 100644 --- a/src/Airports/GenAirports850/closedpoly.cxx +++ b/src/Airports/GenAirports850/closedpoly.cxx @@ -596,14 +596,7 @@ int ClosedPoly::BuildBtg( float alt_m, superpoly_list* rwy_polys, texparams_list if ( apt_base ) { - // ExpandContour( hull, base, 20.0 ); base = tgPolygonExpand( pre_tess, 20.0); - - // dump pre_tess and base - //SG_LOG(SG_GENERAL, SG_INFO, "BuildBtg: original poly " << pre_tess ); - //SG_LOG(SG_GENERAL, SG_INFO, "BuildBtg: expanded poly " << base ); - - // ExpandContour( hull, safe_base, 50.0 ); safe_base = tgPolygonExpand( pre_tess, 50.0); // add this to the airport clearing @@ -619,6 +612,8 @@ int ClosedPoly::BuildBtg( float alt_m, superpoly_list* rwy_polys, texparams_list return 1; } +// Just used for user defined border - add a little bit, as some modelers made the border exactly on the edges +// - resulting in no base, which we can't handle int ClosedPoly::BuildBtg( float alt_m, TGPolygon* apt_base, TGPolygon* apt_clearing ) { TGPolygon base, safe_base; @@ -628,14 +623,14 @@ int ClosedPoly::BuildBtg( float alt_m, TGPolygon* apt_base, TGPolygon* apt_clear { SG_LOG(SG_GENERAL, SG_DEBUG, "BuildBtg: original poly has " << pre_tess.contours() << " contours"); - hull = pre_tess.get_contour(0); - ExpandContour( hull, safe_base, 20.0 ); + base = tgPolygonExpand( pre_tess, 2.0); + safe_base = tgPolygonExpand( pre_tess, 5.0); // add this to the airport clearing *apt_clearing = tgPolygonUnion( safe_base, *apt_clearing); // and add the clearing to the base - *apt_base = tgPolygonUnion( pre_tess, *apt_base ); + *apt_base = tgPolygonUnion( base, *apt_base ); } return 1;