BOOL IsPtInPolygon(Point p,Point *c,int count)
{
int i,j;
bool status = false;
for (i = 0, j = count-1; i < count; j = i++)
{
if ((((c[i].y<=p.y) && (p.y<c[j].y)) || ((c[j].y<=p.y) && (p.y<c[i].y))) && (p.x < (c[j].x - c[i].x) * (p.y - c[i].y) / (c[j].y - c[i].y) + c[i].x))
status = !status;
}
return status;
}
{
int i,j;
bool status = false;
for (i = 0, j = count-1; i < count; j = i++)
{
if ((((c[i].y<=p.y) && (p.y<c[j].y)) || ((c[j].y<=p.y) && (p.y<c[i].y))) && (p.x < (c[j].x - c[i].x) * (p.y - c[i].y) / (c[j].y - c[i].y) + c[i].x))
status = !status;
}
return status;
}