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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun Apr 24 16:59:54 EDT 2011


Author: mhugent
Date: 2011-04-24 13:59:54 -0700 (Sun, 24 Apr 2011)
New Revision: 15817

Modified:
   trunk/qgis/src/core/qgsclipper.h
Log:
Better error handling for polygon clipping

Modified: trunk/qgis/src/core/qgsclipper.h
===================================================================
--- trunk/qgis/src/core/qgsclipper.h	2011-04-24 11:59:39 UTC (rev 15816)
+++ trunk/qgis/src/core/qgsclipper.h	2011-04-24 20:59:54 UTC (rev 15817)
@@ -421,18 +421,12 @@
       break;
   }
 
-  if ( std::abs( r_d ) > SMALL_NUM && std::abs( r_n ) > SMALL_NUM )
-  { // they cross
-    double r = r_n / r_d;
-    return QPointF( x1 + r*( x2 - x1 ), y1 + r*( y2 - y1 ) );
-  }
-  else
+  double r = 0;
+  if ( !doubleNear( r_d, 0.0 ) )
   {
-    // Should never get here, but if we do for some reason, cause a
-    // clunk because something else is wrong if we do.
-    Q_ASSERT( std::abs( r_d ) > SMALL_NUM && std::abs( r_n ) > SMALL_NUM );
-    return QPointF();
+    r = r_n / r_d;
   }
+  return QPointF( x1 + r*( x2 - x1 ), y1 + r*( y2 - y1 ) );
 }
 
 inline void QgsClipper::clipStartTop( double& x0, double& y0, const double& x1, const double& y1, double yMax )



More information about the QGIS-commit mailing list