fixup mirroring for subpatterns
This commit is contained in:
parent
4bc51f765f
commit
f3669f2dfd
@ -439,8 +439,10 @@ def _subpatterns_to_refs(subpatterns: List[SubPattern or GridRepetition]
|
|||||||
for subpat in subpatterns:
|
for subpat in subpatterns:
|
||||||
encoded_name = subpat.pattern.name
|
encoded_name = subpat.pattern.name
|
||||||
|
|
||||||
|
# Note: GDS mirrors first and rotates second
|
||||||
|
mirror_x, extra_angle = normalize_mirror(subpat.mirrored)
|
||||||
if isinstance(subpat, GridRepetition):
|
if isinstance(subpat, GridRepetition):
|
||||||
mirror_signs = (-1) ** numpy.array(subpat.mirrored)
|
mirror_signs = [(-1 if mirror_x else 1), 1]
|
||||||
xy = numpy.array(subpat.offset) + [
|
xy = numpy.array(subpat.offset) + [
|
||||||
[0, 0],
|
[0, 0],
|
||||||
numpy.dot(rotation_matrix_2d(subpat.rotation), subpat.a_vector * mirror_signs) * subpat.scale * subpat.a_count,
|
numpy.dot(rotation_matrix_2d(subpat.rotation), subpat.a_vector * mirror_signs) * subpat.scale * subpat.a_count,
|
||||||
@ -454,7 +456,6 @@ def _subpatterns_to_refs(subpatterns: List[SubPattern or GridRepetition]
|
|||||||
ref = gdsii.elements.SRef(struct_name=encoded_name,
|
ref = gdsii.elements.SRef(struct_name=encoded_name,
|
||||||
xy=numpy.round([subpat.offset]).astype(int))
|
xy=numpy.round([subpat.offset]).astype(int))
|
||||||
|
|
||||||
mirror_x, extra_angle = normalize_mirror(subpat.mirrored)
|
|
||||||
ref.angle = ((subpat.rotation + extra_angle) * 180 / numpy.pi) % 360
|
ref.angle = ((subpat.rotation + extra_angle) * 180 / numpy.pi) % 360
|
||||||
# strans must be non-None for angle and mag to take effect
|
# strans must be non-None for angle and mag to take effect
|
||||||
ref.strans = set_bit(0, 15 - 0, mirror_x)
|
ref.strans = set_bit(0, 15 - 0, mirror_x)
|
||||||
|
@ -281,6 +281,10 @@ class GridRepetition:
|
|||||||
:return: self
|
:return: self
|
||||||
"""
|
"""
|
||||||
self.mirrored[axis] = not self.mirrored[axis]
|
self.mirrored[axis] = not self.mirrored[axis]
|
||||||
|
self.rotation *= -1
|
||||||
|
self.a_vector[axis] *= -1
|
||||||
|
if self.b_vector is not None:
|
||||||
|
self.b_vector[axis] *= -1
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def get_bounds(self) -> numpy.ndarray or None:
|
def get_bounds(self) -> numpy.ndarray or None:
|
||||||
|
@ -181,6 +181,7 @@ class SubPattern:
|
|||||||
:return: self
|
:return: self
|
||||||
"""
|
"""
|
||||||
self.mirrored[axis] = not self.mirrored[axis]
|
self.mirrored[axis] = not self.mirrored[axis]
|
||||||
|
self.rotation *= -1
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def get_bounds(self) -> numpy.ndarray or None:
|
def get_bounds(self) -> numpy.ndarray or None:
|
||||||
|
Loading…
Reference in New Issue
Block a user