Python: checking if point is inside a polygon
问题 I have a class describing a Point (has 2 coordinates x and y) and a class describing a Polygon which has a list of Points which correspond to corners (self.corners) I need to check if a Point is in a Polygon Here is the function that is supposed to check if the Point in in the Polygon. I am using the Ray Casting Method def in_me(self, point): result = False n = len(self.corners) p1x = int(self.corners[0].x) p1y = int(self.corners[0].y) for i in range(n+1): p2x = int(self.corners[i % n].x) p2y