Read about Polygon class. It will be much easier to complete the task with a point
Justin SmithLevel 41, Greenfield, USA, United States
12 June 2023
You can do this but honestly I found it much more interesting and rewarding to calculate it mathematically, and the code is not terribly complicated in doing so.
If you decide to do it mathematically as I did, the main crux is understanding that a line that extends from the point in any direction infinitely will encounter an odd number of intersections if it is inside the polygon, and an even number of intersections if it is outside the polygon.
GO TO FULL VERSION