fix mirroring for rotated ports/devices

This commit is contained in:
Jan Petykiewicz 2020-12-05 14:50:16 -08:00
parent b7383a30ca
commit 479e0c3c2e

View File

@ -79,7 +79,8 @@ class Port(PositionableImpl, Rotatable, PivotableImpl, Copyable, Mirrorable, met
def mirror(self: P, axis: int) -> P: def mirror(self: P, axis: int) -> P:
self.offset[1 - axis] *= -1 self.offset[1 - axis] *= -1
if self.rotation is not None: if self.rotation is not None:
self.rotation += pi self.rotation *= -1
self.rotation += axis * pi
return self return self
def rotate(self: P, rotation: float) -> P: def rotate(self: P, rotation: float) -> P:
@ -606,9 +607,10 @@ class Device(Copyable, Mirrorable):
if mirrored[0]: if mirrored[0]:
o_offsets[:, 1] *= -1 o_offsets[:, 1] *= -1
o_rotations += pi o_rotations *= -1
if mirrored[1]: if mirrored[1]:
o_offsets[:, 0] *= -1 o_offsets[:, 0] *= -1
o_rotations *= -1
o_rotations += pi o_rotations += pi
type_conflicts = (s_types != o_types) & (s_types != 0) & (o_types != 0) type_conflicts = (s_types != o_types) & (s_types != 0) & (o_types != 0)