示例#1
0
 def test_slerp(self):
     transform1 = rotate_z(30.0)
     q1 = Quaternion.from_transform(transform1)
     transform2 = rotate_z(90.0)
     q2 = Quaternion.from_transform(transform2)
     q_interp = slerp(0.5, q1, q2)
     transform3 = rotate_z(60)
     q3 = Quaternion.from_transform(transform3)
     self.assertEqual(q_interp, q3)
     self.assertEqual(q_interp.to_transform(), transform3)
示例#2
0
 def test_rotate(self):
     self.assertEqual(rotate(40, Vector(1.0, 0.0, 0.0)),
                      rotate_x(40))
     self.assertEqual(rotate(20, Vector(0.0, 1.0, 0.0)),
                      rotate_y(20))
     self.assertEqual(rotate(70, Vector(0.0, 0.0, 1.0)),
                      rotate_z(70))
示例#3
0
 def test_normalize(self):
     q = Quaternion.from_transform(rotate_z(30.0))
     self.assertEqual(normalize(q), q)