[RenderStep] fix mirroring a planned path
This commit is contained in:
parent
932565d531
commit
707a16fe64
2 changed files with 13 additions and 2 deletions
|
|
@ -85,8 +85,8 @@ class RenderStep:
|
|||
new_start = self.start_port.copy()
|
||||
new_end = self.end_port.copy()
|
||||
|
||||
new_start.mirror(axis)
|
||||
new_end.mirror(axis)
|
||||
new_start.flip_across(axis=axis)
|
||||
new_end.flip_across(axis=axis)
|
||||
|
||||
return RenderStep(
|
||||
opcode = self.opcode,
|
||||
|
|
|
|||
|
|
@ -65,6 +65,17 @@ def test_renderpather_bend(rpather_setup: tuple[RenderPather, PathTool, Library]
|
|||
assert_allclose(path_shape.vertices, [[0, 0], [0, -10], [0, -20], [-1, -20]], atol=1e-10)
|
||||
|
||||
|
||||
def test_renderpather_mirror_preserves_planned_bend_geometry(rpather_setup: tuple[RenderPather, PathTool, Library]) -> None:
|
||||
rp, tool, lib = rpather_setup
|
||||
rp.at("start").straight(10).cw(10)
|
||||
|
||||
rp.mirror(0)
|
||||
rp.render()
|
||||
|
||||
path_shape = cast("Path", rp.pattern.shapes[(1, 0)][0])
|
||||
assert_allclose(path_shape.vertices, [[0, 0], [0, 10], [0, 20], [-1, 20]], atol=1e-10)
|
||||
|
||||
|
||||
def test_renderpather_retool(rpather_setup: tuple[RenderPather, PathTool, Library]) -> None:
|
||||
rp, tool1, lib = rpather_setup
|
||||
tool2 = PathTool(layer=(2, 0), width=4, ptype="wire")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue