Skip to content

Commit 7c96f7f

Browse files
author
mhugent
committedNov 12, 2010
Catch nans and infs in clipper. Fixes #3081
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14554 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed
 

‎src/core/qgsclipper.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,18 @@ inline void QgsClipper::trimFeatureToBoundary(
154154

155155
// and compare to the first point initially.
156156
for ( unsigned int i2 = 0; i2 < inX.size() ; ++i2 )
157-
{ // look at each edge of the polygon in turn
157+
{
158+
// look at each edge of the polygon in turn
159+
160+
//ignore segments with nan or inf coordinates
161+
if ( isnan( inX[i2] ) || isnan( inY[i2] ) || isinf( inX[i2] ) || isinf( inY[i2] )
162+
|| isnan( inX[i1] ) || isnan( inY[i1] ) || isinf( inX[i1] ) || isinf( inY[i1] ) )
163+
{
164+
i1 = i2;
165+
continue;
166+
}
167+
168+
158169
if ( inside( inX[i2], inY[i2], b ) ) // end point of edge is inside boundary
159170
{
160171
if ( inside( inX[i1], inY[i1], b ) )

0 commit comments

Comments
 (0)
Please sign in to comment.