def tfm2(x, y, z, tfm0=tfm0, tfm=tfm, index=index): v = V(x,y,z) v = tfm0(v) while index: v = tfm(v) index -= 1 return tuple(v)
def transform(self, t): if t.func_code.co_argcount == 1: for a in self.atoms.values(): v = V(a.x, a.y, a.z) a.x, a.y, a.z = tuple(t(v)) else: for a in self.atoms.values(): a.x, a.y, a.z = t(a.x, a.y, a.z)
def tfm(v, k=k): angle = pi / 6 x, y, z = tuple(v) c, s = cos(angle), sin(angle) x, y = c * x + s * y, -s * x + c * y if (k[0] & 1) == 0: zdiff = 1.67 else: zdiff = 5.76 k[0] += 1 return V(x, y, z + zdiff)
def posn(self): return V(self.x, self.y, self.z)
def tfm0(v, k=k): k[0] = 0 return V(v[0], v[1], v[2] - 20.2)
def tfm(v): angle = -36 * pi / 180 x, y, z = tuple(v) c, s = cos(angle), sin(angle) x, y = c * x + s * y, -s * x + c * y return V(x, y, z + 3.391)
def tfm0(v): return v + V(0, 0, -18.7)