Пример #1
0
 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
Пример #2
0
 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
Пример #3
0
 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