def set_chained_transition(self, quaternions, dts, methods): assert len(quaternions) > 0 if isinstance(dts, list) or isinstance(dts, tuple): assert len(dts) == len(quaternions) else: dts = [dts] * len(quaternions) if isinstance(methods, list) or isinstance(methods, tuple): assert len(methods) == len(quaternions) else: methods = [methods] * len(quaternions) w_chain = [] prev_w = self.w x_chain = [] prev_x = self.x y_chain = [] prev_y = self.y z_chain = [] prev_z = self.z for quat, dt, method in zip(quaternions, dts, methods): w_chain.append(animate(prev_w, quat.w, dt=dt, method=method)) x_chain.append(animate(prev_x, quat.x, dt=dt, method=method)) y_chain.append(animate(prev_y, quat.y, dt=dt, method=method)) z_chain.append(animate(prev_z, quat.z, dt=dt, method=method)) prev_w = quat.w prev_x = quat.x prev_y = quat.y prev_z = quat.z self.w = chain(w_chain) self.x = chain(x_chain) self.y = chain(y_chain) self.z = chain(z_chain)
def set_chained_transition(self, positions, dts, methods): assert len(positions) > 0 if isinstance(dts, list) or isinstance(dts, tuple): assert len(dts) == len(positions) else: dts = [dts] * len(positions) if isinstance(methods, list) or isinstance(methods, tuple): assert len(methods) == len(positions) else: methods = [methods] * len(positions) x_chain = [] prev_x = self.x y_chain = [] prev_y = self.y z_chain = [] prev_z = self.z for pos, dt, method in zip(positions, dts, methods): x_chain.append(animate(prev_x, pos.x, dt=dt, method=method)) y_chain.append(animate(prev_y, pos.y, dt=dt, method=method)) z_chain.append(animate(prev_z, pos.z, dt=dt, method=method)) prev_x = pos.x prev_y = pos.y prev_z = pos.z self.x = chain(x_chain) self.y = chain(y_chain) self.z = chain(z_chain)
def set_chained_transition(self, positions, dts, methods): assert len(positions) > 0 if isinstance(dts, list) or isinstance(dts, tuple): assert len(dts) == len(positions) else: dts = [dts]*len(positions) if isinstance(methods, list) or isinstance(methods, tuple): assert len(methods) == len(positions) else: methods = [methods]*len(positions) x_chain = []; prev_x = self.x y_chain = []; prev_y = self.y z_chain = []; prev_z = self.z for pos, dt, method in zip(positions, dts, methods): x_chain.append(animate(prev_x, pos.x, dt=dt, method=method)) y_chain.append(animate(prev_y, pos.y, dt=dt, method=method)) z_chain.append(animate(prev_z, pos.z, dt=dt, method=method)) prev_x = pos.x; prev_y = pos.y; prev_z = pos.z self.x = chain(x_chain) self.y = chain(y_chain) self.z = chain(z_chain)
def set_chained_transition(self, quaternions, dts, methods): assert len(quaternions) > 0 if isinstance(dts, list) or isinstance(dts, tuple): assert len(dts) == len(quaternions) else: dts = [dts]*len(quaternions) if isinstance(methods, list) or isinstance(methods, tuple): assert len(methods) == len(quaternions) else: methods = [methods]*len(quaternions) w_chain = []; prev_w = self.w x_chain = []; prev_x = self.x y_chain = []; prev_y = self.y z_chain = []; prev_z = self.z for quat, dt, method in zip(quaternions, dts, methods): w_chain.append(animate(prev_w, quat.w, dt=dt, method=method)) x_chain.append(animate(prev_x, quat.x, dt=dt, method=method)) y_chain.append(animate(prev_y, quat.y, dt=dt, method=method)) z_chain.append(animate(prev_z, quat.z, dt=dt, method=method)) prev_w = quat.w; prev_x = quat.x; prev_y = quat.y; prev_z = quat.z self.w = chain(w_chain) self.x = chain(x_chain) self.y = chain(y_chain) self.z = chain(z_chain)