Fix order of rotation/mirror/offset when calling as_pattern() on repetitions

This commit is contained in:
Jan Petykiewicz 2020-07-08 18:21:42 -07:00
parent 53d2a9ca1a
commit f3a1db30c5

View File

@ -332,22 +332,20 @@ class GridRepetition:
assert(self.pattern is not None) assert(self.pattern is not None)
patterns = [] 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 a in range(self.a_count):
for b in range(self.b_count): for b in range(self.b_count):
offset = a * self.a_vector + b * self.b_vector offset = a * self.a_vector + b * self.b_vector
newPat = self.pattern.deepcopy().deepunlock() newPat = pat.deepcopy()
newPat.translate_elements(offset) newPat.translate_elements(offset)
patterns.append(newPat) combined.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)
return combined return combined