def test_quaternion_slerp(self): q0 = t.random_quaternion() q1 = t.random_quaternion() q = self.f(q0, q1, 0.0) assert_allclose(q, q0, atol=_ATOL) q = self.f(q0, q1, 1.0, 1) assert_allclose(q, q1, atol=_ATOL) q = self.f(q0, q1, 0.5) angle = math.acos(np.dot(q0, q)) check = (np.allclose(2.0, math.acos(np.dot(q0, q1)) / angle) or np.allclose(2.0, math.acos(-np.dot(q0, q1)) / angle)) assert_equal(check, True)
def test_quaternion_slerp(self): q0 = t.random_quaternion() q1 = t.random_quaternion() q = self.f(q0, q1, 0.0) assert_allclose(q, q0, atol=_ATOL) q = self.f(q0, q1, 1.0, 1) assert_allclose(q, q1, atol=_ATOL) q = self.f(q0, q1, 0.5) angle = np.arccos(np.dot(q0, q)) check = (np.allclose(2.0, np.arccos(np.dot(q0, q1)) / angle) or np.allclose(2.0, np.arccos(-np.dot(q0, q1)) / angle)) assert_equal(check, True)
def test_quaternion_inverse(self): q0 = t.random_quaternion() q1 = self.f(q0) assert_allclose(t.quaternion_multiply(q0, q1), [1, 0, 0, 0], atol=_ATOL)
def test_quaternion_conjugate(self): q0 = t.random_quaternion() q1 = self.f(q0) check = q1[0] == q0[0] and all(q1[1:] == -q0[1:]) assert_equal(check, True)