Skip to content

Commit ab95bbf

Browse files
author
mhugent
committedApr 24, 2011
Better error handling for polygon clipping
git-svn-id: http://svn.osgeo.org/qgis/trunk@15817 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent ba0e5ad commit ab95bbf

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed
 

‎src/core/qgsclipper.h

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -421,18 +421,12 @@ inline QPointF QgsClipper::intersectRect( const QPointF& pt1,
421421
break;
422422
}
423423

424-
if ( std::abs( r_d ) > SMALL_NUM && std::abs( r_n ) > SMALL_NUM )
425-
{ // they cross
426-
double r = r_n / r_d;
427-
return QPointF( x1 + r*( x2 - x1 ), y1 + r*( y2 - y1 ) );
428-
}
429-
else
424+
double r = 0;
425+
if ( !doubleNear( r_d, 0.0 ) )
430426
{
431-
// Should never get here, but if we do for some reason, cause a
432-
// clunk because something else is wrong if we do.
433-
Q_ASSERT( std::abs( r_d ) > SMALL_NUM && std::abs( r_n ) > SMALL_NUM );
434-
return QPointF();
427+
r = r_n / r_d;
435428
}
429+
return QPointF( x1 + r*( x2 - x1 ), y1 + r*( y2 - y1 ) );
436430
}
437431

438432
inline void QgsClipper::clipStartTop( double& x0, double& y0, const double& x1, const double& y1, double yMax )

0 commit comments

Comments
 (0)
Please sign in to comment.