Commit e5c66b5e authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

fixed pointPolygonTest(). Now it returns -1, 0, 1 when measureDist=false (ticket #1285)

parent 99e3b5a2
...@@ -169,7 +169,7 @@ cvPointPolygonTest( const CvArr* _contour, CvPoint2D32f pt, int measure_dist ) ...@@ -169,7 +169,7 @@ cvPointPolygonTest( const CvArr* _contour, CvPoint2D32f pt, int measure_dist )
CvRect r = ((CvContour*)contour)->rect; CvRect r = ((CvContour*)contour)->rect;
if( pt.x < r.x || pt.y < r.y || if( pt.x < r.x || pt.y < r.y ||
pt.x >= r.x + r.width || pt.y >= r.y + r.height ) pt.x >= r.x + r.width || pt.y >= r.y + r.height )
return -100; return -1;
} }
} }
else if( CV_IS_SEQ_CHAIN(contour) ) else if( CV_IS_SEQ_CHAIN(contour) )
...@@ -214,7 +214,7 @@ cvPointPolygonTest( const CvArr* _contour, CvPoint2D32f pt, int measure_dist ) ...@@ -214,7 +214,7 @@ cvPointPolygonTest( const CvArr* _contour, CvPoint2D32f pt, int measure_dist )
counter += dist > 0; counter += dist > 0;
} }
result = counter % 2 == 0 ? -100 : 100; result = counter % 2 == 0 ? -1 : 1;
} }
else else
{ {
...@@ -265,7 +265,7 @@ cvPointPolygonTest( const CvArr* _contour, CvPoint2D32f pt, int measure_dist ) ...@@ -265,7 +265,7 @@ cvPointPolygonTest( const CvArr* _contour, CvPoint2D32f pt, int measure_dist )
counter += dist > 0; counter += dist > 0;
} }
result = counter % 2 == 0 ? -100 : 100; result = counter % 2 == 0 ? -1 : 1;
} }
else else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment