def check_point(self, point): if not self.check_collisions: return True for territory in self.land_terrs: for tri in territory.triangles: if util.point_inside_polygon(point.x, point.y, tri): return False return True
def maFonction(self, a, b): self.mutex.acquire() sys.stdout.write("majDistance : mutex Acquire\n") prox = 0 self.distancexy = [] self.Obstacles = [] for i, d in enumerate(self.data): self.distancexy.append( lidarDistance2xy((self.xLidar, self.yLidar), self.orientationLidar, d, i)) if d < 400: prox = 1 if point_inside_polygon(self.distancexy[-1], self.LimiteTerrain): self.Obstacles.append(self.distancexy[-1]) self.proximityAlert = prox self.mutex.release() sys.stdout.write("majDistance : mutex Release\n")
def point_inside(self, x, y): """Returns True if (x,y) is inside the territory.""" for tri in self.triangles: if util.point_inside_polygon(x, y, tri): return True return False