def rated_nodes_within(self, polygon: mapping.Polygon, min_rating=0) -> List[Node]: return [ x for x in self.rated_nodes(min_rating) if polygon.point_in_poly(x.position) ]
def test_poly_random(self): points = [ Point(1, 2), Point(3, 1), Point(7, 2), Point(9, 4), Point(6, 6), Point(6, 9), Point(4, 8), Point(2, 9), Point(1, 7), Point(0, 5)] poly = Polygon(points) for i in range(0, 100): rp = poly.random_point() self.assertTrue(poly.point_in_poly(rp))
def nodes_within(self, polygon: mapping.Polygon) -> List[Node]: return [x for x in self.nodes if polygon.point_in_poly(x.position)]
def rated_nodes_within(self, polygon: mapping.Polygon, min_rating=0) -> List[Node]: return [x for x in self.rated_nodes(min_rating) if polygon.point_in_poly(x.position)]
def nodes_within(self, polygon: mapping.Polygon) -> List[Node]: return [x for x in self.nodes if polygon.point_in_poly(x.position)]