| 86 | |
| 87 | |
| 88 | def convert_and_validate(edges: Iterable[Edge]) -> Tuple[List[Arc], List[Point]]: |
| 89 | |
| 90 | arcs: Set[Arc] = set() |
| 91 | points: Set[Point] = set() |
| 92 | |
| 93 | for e in edges: |
| 94 | gt = e.geomType() |
| 95 | |
| 96 | if gt == "LINE": |
| 97 | p1 = e.startPoint() |
| 98 | p2 = e.endPoint() |
| 99 | |
| 100 | points.update((Point(p1.x, p1.y), Point(p2.x, p2.y))) |
| 101 | |
| 102 | elif gt == "CIRCLE": |
| 103 | c = e.arcCenter() |
| 104 | r = e.radius() |
| 105 | a1, a2 = e._bounds() |
| 106 | |
| 107 | arcs.add(Arc(Point(c.x, c.y), r, a1, a2)) |
| 108 | |
| 109 | else: |
| 110 | raise ValueError("Unsupported geometry {gt}") |
| 111 | |
| 112 | return list(arcs), list(points) |
| 113 | |
| 114 | |
| 115 | def select_lowest_point(points: Points) -> Tuple[Point, int]: |