示例#1
0
 def __init__(self, src, dest, eid):
     self.src = src
     self.dest = dest
     self.name = "e" + str(eid)
     self.segment = KER.Segment_2(src.point_2, dest.point_2)
     self.node_conflicts = []
     self.edge_conflicts = set()
     self.cost = sqrt(
         KER.squared_distance(src.point_2, dest.point_2).to_double())
示例#2
0
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