From f3a1db30c58b5a0d1014b51b0e845c3908f4853f Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Wed, 8 Jul 2020 18:21:42 -0700 Subject: [PATCH] Fix order of rotation/mirror/offset when calling as_pattern() on repetitions --- masque/repetition.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/masque/repetition.py b/masque/repetition.py index 247f1eb..81e8b86 100644 --- a/masque/repetition.py +++ b/masque/repetition.py @@ -332,22 +332,20 @@ class GridRepetition: assert(self.pattern is not None) patterns = [] + pat = self.pattern.deepcopy().deepunlock() + pat.scale_by(self.scale) + [pat.mirror(ax) for ax, do in enumerate(self.mirrored) if do] + pat.rotate_around((0.0, 0.0), self.rotation) + pat.translate_elements(self.offset) + pat.scale_element_doses(self.dose) + + combined = type(pat)(name='__GridRepetition__') for a in range(self.a_count): for b in range(self.b_count): offset = a * self.a_vector + b * self.b_vector - newPat = self.pattern.deepcopy().deepunlock() + newPat = pat.deepcopy() newPat.translate_elements(offset) - patterns.append(newPat) - - combined = patterns[0] - for p in patterns[1:]: - combined.append(p) - - combined.scale_by(self.scale) - [combined.mirror(ax) for ax, do in enumerate(self.mirrored) if do] - combined.rotate_around((0.0, 0.0), self.rotation) - combined.translate_elements(self.offset) - combined.scale_element_doses(self.dose) + combined.append(newPat) return combined