1
0
Fork 0

Test for contour parts of zero size and ignore them,

which otherwise leads to a segfault.
This commit is contained in:
Christian Schmitt 2012-04-06 13:54:26 +02:00
parent ab931442d0
commit 451e63f84e

View file

@ -1167,10 +1167,12 @@ TGPolygon reduce_degeneracy( const TGPolygon& poly ) {
TGPolygon result; TGPolygon result;
for ( int i = 0; i < poly.contours(); ++i ) { for ( int i = 0; i < poly.contours(); ++i ) {
// cout << "reduce_degeneracy() contour = " << i << endl; if ( poly.get_contour(i).size() > 0)
point_list contour = poly.get_contour(i); {
contour = reduce_contour_degeneracy( contour ); point_list contour = poly.get_contour(i);
result.add_contour( contour, poly.get_hole_flag(i) ); contour = reduce_contour_degeneracy( contour );
result.add_contour( contour, poly.get_hole_flag(i) );
}
// maintain original hole flag setting // maintain original hole flag setting
// result.set_hole_flag( i, poly.get_hole_flag( i ) ); // result.set_hole_flag( i, poly.get_hole_flag( i ) );