def make_graph(cd, milestones, nn): g = PrmGraph(milestones) for milestone in milestones: p = milestone.point nearest = nn.neighbors_in_radius(p, Config.connection_radius) for neighbor in nearest: if neighbor == p: continue edge = KER.Segment_2(KER.Point_2(p[0], p[1]), KER.Point_2(neighbor[0], neighbor[1])) if cd.is_edge_valid(edge): g.insert_edge(milestone, neighbor) return g
def tuples_list_to_polygon_2(lst): lst0 = [] for tuple in lst: lst0.append(KER.Point_2(tuple[0], tuple[1])) p = POL2.Polygon_2(lst0) if p.is_clockwise_oriented(): p.reverse_orientation() return p
def coords_list_to_polygon_2(lst): lst0 = [] for i in range(len(lst) // 2): lst0.append(KER.Point_2(lst[2 * i], lst[2 * i + 1])) p = POL2.Polygon_2(lst0) if p.is_clockwise_oriented(): p.reverse_orientation() return p
def point_d_to_point_2(x): return KER.Point_2(x[0], x[1])
def xy_to_point_2(x, y): return KER.Point_2(x, y)