Skip to content

Commit

Permalink
Better error handling for polygon clipping
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15817 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Apr 24, 2011
1 parent 6e2f964 commit e9435eb
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/core/qgsclipper.h
Original file line number Diff line number Diff line change
Expand Up @@ -421,18 +421,12 @@ inline QPointF QgsClipper::intersectRect( const QPointF& pt1,
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 )
Expand Down

0 comments on commit e9435eb

Please sign in to comment.