Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool InPoly(int x,y; Polygon poly) {
- int h := poly.size();
- int j := h;
- int Result := false;
- for(var i=0; i < h; i++) {
- if ((poly[i].y < y) && (poly[j].y >= y) || (poly[j].y < y) and (poly[i].y >= y)) &&
- (poly[i].x + (y - poly[i].y) / (poly[j].y - poly[i].y) * (poly[j].x - poly[i].x) < x)
- Result := !Result;
- j := i;
- };
- return Result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement