Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int i, j, n, hit;
- outline_pt *poly;
- hit = 0;
- n = 4;
- poly = part->outline;
- for (i = 0, j = n - 1; i < n; j = i++) {
- if (((poly[i].y > pos.y) != (poly[j].y > pos.y)) &&
- (pos.x < (poly[j].x - poly[i].x) * (pos.y - poly[i].y) / (poly[j].y - poly[i].y) + poly[i].x))
- hit = !hit;
- }
- // if hit != 0, then point is in quad.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement