1 | initial version |
try :
Point p1,p2,p3,p4;
.....
vector<Point> ctr;
ctr.push_back(p1);
ctr.push_back(p2);
ctr.push_back(p3);
ctr.push_back(p4);
bool inside = pointPolygonTest ( ctr,Point2f(254,30.1),false);
2 | No.2 Revision |
try :
Point p1,p2,p3,p4;
.....
vector<Point> ctr;
ctr.push_back(p1);
ctr.push_back(p2);
ctr.push_back(p3);
ctr.push_back(p4);
double
inside = pointPolygonTest (3 | No.3 Revision |
try :
Point p1,p2,p3,p4;
.....
vector<Point> ctr;
ctr.push_back(p1);
ctr.push_back(p2);
ctr.push_back(p3);
ctr.push_back(p4);
4 | No.4 Revision |
try :
Point p1,p2,p3,p4;
.....
vector<Point> ctr;
ctr.push_back(p1);
ctr.push_back(p2);
ctr.push_back(p3);
ctr.push_back(p4);
double inside;
inside = pointPolygonTest pointPolygonTest(ctr, Point2f(254, 30.1), false);
if (inside < 0)
( ctr,Point2f(254,30.1),false);
cout << "Outside\n";
else if (inside > 0)
cout << "inside\n";
else
cout << "contour points\n";
inside= pointPolygonTest(ctr, Point2f(50, 50), false);
if (inside < 0)
cout << "Outside\n";
else if (inside > 0)
cout << "inside\n";
else
cout << "contour points\n";
inside = pointPolygonTest(ctr, Point2f(10, 50), false);
if (inside < 0)
cout << "Outside\n";
else if (inside > 0)
cout << "inside\n";
else
cout << "contour points\n";
Results :
Outside inside contour points
5 | No.5 Revision |
try :
double inside;
inside = pointPolygonTest(ctr, Point2f(254, 30.1), false);
if (inside < 0)
cout << "Outside\n";
else if (inside > 0)
cout << "inside\n";
else
cout << "contour points\n";
inside= pointPolygonTest(ctr, Point2f(50, 50), false);
if (inside < 0)
cout << "Outside\n";
else if (inside > 0)
cout << "inside\n";
else
cout << "contour points\n";
inside = pointPolygonTest(ctr, Point2f(10, 50), false);
if (inside < 0)
cout << "Outside\n";
else if (inside > 0)
cout << "inside\n";
else
cout << "contour points\n";
Results :
OutsideOutsideinside
contour points
6 | No.6 Revision |
try :
Point p1(10,10),p4(10,100), p3(100,100), p2(100,10) ;
vector<Point> ctr;
ctr.push_back(p1);
ctr.push_back(p4);
ctr.push_back(p3);
ctr.push_back(p2);
double inside;
inside = pointPolygonTest(ctr, Point2f(254, 30.1), false);
if (inside < 0)
cout << "Outside\n";
else if (inside > 0)
cout << "inside\n";
else
cout << "contour points\n";
inside= pointPolygonTest(ctr, Point2f(50, 50), false);
if (inside < 0)
cout << "Outside\n";
else if (inside > 0)
cout << "inside\n";
else
cout << "contour points\n";
inside = pointPolygonTest(ctr, Point2f(10, 50), false);
if (inside < 0)
cout << "Outside\n";
else if (inside > 0)
cout << "inside\n";
else
cout << "contour points\n";
Results :
Outside
inside
contour points