Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def pt_in(pt, poly):
- testX, testY = pt
- last = poly[-1]
- answer = False
- for now in poly:
- nowX, nowY = now
- lastX, lastY = last
- if (nowY > testY) != (lastY > testY) and (testX < (lastX - nowX) * (testY - nowY)/(lastY - nowY) + nowX):
- answer = not answer
- last = now
- return answer
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement