[QGIS Commit] r14554 - trunk/qgis/src/core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Fri Nov 12 07:19:00 EST 2010


Author: mhugent
Date: 2010-11-12 04:19:00 -0800 (Fri, 12 Nov 2010)
New Revision: 14554

Modified:
   trunk/qgis/src/core/qgsclipper.h
Log:
Catch nans and infs in clipper. Fixes #3081

Modified: trunk/qgis/src/core/qgsclipper.h
===================================================================
--- trunk/qgis/src/core/qgsclipper.h	2010-11-12 11:25:37 UTC (rev 14553)
+++ trunk/qgis/src/core/qgsclipper.h	2010-11-12 12:19:00 UTC (rev 14554)
@@ -154,7 +154,18 @@
 
   // and compare to the first point initially.
   for ( unsigned int i2 = 0; i2 < inX.size() ; ++i2 )
-  { // look at each edge of the polygon in turn
+  {
+    // look at each edge of the polygon in turn
+
+    //ignore segments with nan or inf coordinates
+    if ( isnan( inX[i2] ) || isnan( inY[i2] ) || isinf( inX[i2] ) || isinf( inY[i2] )
+         || isnan( inX[i1] ) || isnan( inY[i1] ) || isinf( inX[i1] ) || isinf( inY[i1] ) )
+    {
+      i1 = i2;
+      continue;
+    }
+
+
     if ( inside( inX[i2], inY[i2], b ) ) // end point of edge is inside boundary
     {
       if ( inside( inX[i1], inY[i1], b ) )



More information about the QGIS-commit mailing list