def test_quaternion_from_vectors3(self): a = np.array([1., 0., 0.]) b = np.array([0., 2., 0.]) q = quaternion_from_vectors(a, b) # 90 degrees in Z axis e = Quaternion(w=0.70710678, x=0.00000000, y=0.00000000, z=0.70710678) assert e == q
def test_quaternion_from_vectors4(self): a = np.array([1., 0., 0.]) b = np.array([-1., 0., 0.]) q = quaternion_from_vectors(a, b) # Orthogonal rotation e = Quaternion(w=0., x=0.00000000, y=-1.0, z=0.) assert e == q
def test_quaternion_from_vectors4(self): a = np.array([1., 0., 0.]) b = np.array([-1., 0., 0.]) q = quaternion_from_vectors(a, b) # Orthogonal rotation, two possibilities: e1 = Quaternion(w=0., x=0., y=1.0, z=0.) e2 = Quaternion(w=0., x=0., y=-1.0, z=0.) assert e1 == q or e2 == q
def test_quaternion_from_vectors2(self): a = np.array([1., 0., 0.]) b = np.array([2., 0., 0.]) q = quaternion_from_vectors(a, b) e = Quaternion() assert e == q