-1

May I ask how can code using python to check if a given points is within the polygon I drawn using turtle?

The polygon is drawn using a list of coordinates.

jays feng
  • 1
  • 2
  • See if this helps: [https://stackoverflow.com/questions/36399381/whats-the-fastest-way-of-checking-if-a-point-is-inside-a-polygon-in-python](https://stackoverflow.com/questions/36399381/whats-the-fastest-way-of-checking-if-a-point-is-inside-a-polygon-in-python) – TomasO Apr 09 '22 at 13:47

3 Answers3

0

There's an answer on Wikipedia with very elegant solutions, implement one to your liking.

here: link

Note: you will probably need to implement a line class and intersections and stuff.

Eilonlif
  • 346
  • 2
  • 7
0

As you mentioned python, if this is not an homework, you should look at Shapely.

Rhangaun
  • 1,430
  • 2
  • 15
  • 34
0

One trick that you can use is to fill your polygon with color and then try to detect that color at the given point location. But the catch is you need to use Tkinter. Here is the link to detect the color at the given location.

Mang Hartono
  • 148
  • 3
  • 7