def next(self): if self.index == self.number_of_vertices: raise StopIteration vert = self.vertsA[self.index] closest = self.closest_point(vert) edges_a = self.tp_A.edges_from_vertex(vert) edges_b = self.tp_B.edges_from_vertex(closest) a1, a2 = Edge(next(edges_a)), Edge(next(edges_a)) b1, b2 = Edge(next(edges_b)), Edge(next(edges_b)) mpA = a1.mid_point() self.index += 1 if mpA.Distance(b1.mid_point()) < mpA.Distance(b2.mid_point()): return iter([a1, a2]), iter([b1, b2]) else: return iter([a1, a2]), iter([b2, b1])
def edges(self): return [Edge(i) for i in WireExplorer(next(self.topo.wires())).ordered_edges()]