Account for trace clearance in forward perimeter screening
This commit is contained in:
parent
2ffd12da5f
commit
f2b646143f
2 changed files with 12 additions and 1 deletions
|
|
@ -265,7 +265,7 @@ def perimeter_detour_candidates(problem: RoutingProblem, search: SearchOptions)
|
||||||
padding = problem.clearance + net.width / 2
|
padding = problem.clearance + net.width / 2
|
||||||
nearby = tuple(bounds for bounds in obstacles if bounds[0] <= net.target.x + padding and bounds[2] >= net.start.x - padding)
|
nearby = tuple(bounds for bounds in obstacles if bounds[0] <= net.target.x + padding and bounds[2] >= net.start.x - padding)
|
||||||
low, high = sorted((net.start.y, net.target.y))
|
low, high = sorted((net.start.y, net.target.y))
|
||||||
if all(bottom > high or top < low or right < net.start.x or left > net.target.x for left, bottom, right, top in nearby):
|
if all(bottom > high + padding or top < low - padding for _, bottom, _, top in nearby):
|
||||||
continue
|
continue
|
||||||
margin = ceil(padding + 1)
|
margin = ceil(padding + 1)
|
||||||
top = max(ceil(top + margin) for _, _, _, top in nearby)
|
top = max(ceil(top + margin) for _, _, _, top in nearby)
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,17 @@ def test_forward_perimeter_lanes_ignore_keepouts_beyond_the_target() -> None:
|
||||||
assert result.as_seed() == clean.as_seed()
|
assert result.as_seed() == clean.as_seed()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(("width", "clearance"), [(4, 0), (2, 2)])
|
||||||
|
def test_forward_perimeter_detours_include_keepouts_clear_of_the_centerline(width, clearance) -> None:
|
||||||
|
net = NetSpec("forward", Port(20, 50, 0), Port(120, 50, 0), width=width)
|
||||||
|
problem = RoutingProblem((0, 0, 150, 100), (net,), (box(55, 51.5, 65, 60),), clearance=clearance)
|
||||||
|
|
||||||
|
run = route(problem, options=OPTIONS)
|
||||||
|
|
||||||
|
assert run.automatic.selected_planner == "perimeter"
|
||||||
|
assert run.results_by_net[net.net_id].is_valid
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("smaller_radius", [10, 17.5])
|
@pytest.mark.parametrize("smaller_radius", [10, 17.5])
|
||||||
def test_perimeter_detours_choose_a_radius_usable_by_the_planner(smaller_radius) -> None:
|
def test_perimeter_detours_choose_a_radius_usable_by_the_planner(smaller_radius) -> None:
|
||||||
net = NetSpec("wide", Port(20, 70, 0), Port(220, 70, 0), width=30)
|
net = NetSpec("wide", Port(20, 70, 0), Port(220, 70, 0), width=30)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue