def rotationFromMove(self, vFrom, vTo): rotAxis = vTo.cross(vFrom) d = Vec(vFrom - vTo) t = d.norm() / (2.0 * 1.0) phi = 2.0 * math.asin(t) rotQuat = Quaternion() rotQuat.fromAxisAngle(rotAxis, phi) rotQuat.normalize() return rotQuat
def axis(self): result = Vec([self.quaternion[0], self.quaternion[1], self.quaternion[2]]) sinus = result.norm() if sinus > 1E-8: result /= sinus if math.acos(self.quaternion[3]) <= (math.pi/2.0): return result else: return -result
def axis(self): result = Vec( [self.quaternion[0], self.quaternion[1], self.quaternion[2]]) sinus = result.norm() if sinus > 1E-8: result /= sinus if math.acos(self.quaternion[3]) <= (math.pi / 2.0): return result else: return -result