def count_inside(self, polygon): """ Will count the number of points in block which are inside polygon. """ inside = 0 for p in self: if GeometryTools.pointInPolygon((p.x, p.y), polygon): inside += 1 return inside
def contains_polyline(self, polyline): """ Will return true if at least one point from the polyline is inside the block. """ edge_polyline = self.getEdgePolygon() for p in polyline: if GeometryTools.pointInPolygon(p, edge_polyline): return True else: edge_polyline.assertClosed() return GeometryTools.polylinesIntersect(edge_polyline, polyline)