def test_euler_equivalence(self): eulers = euler.create_from_x_rotation(np.pi / 2.) m = matrix33.create_from_x_rotation(np.pi / 2.) q = quaternion.create_from_x_rotation(np.pi / 2.) qm = matrix33.create_from_quaternion(q) em = matrix33.create_from_eulers(eulers) self.assertTrue(np.allclose(qm, m)) self.assertTrue(np.allclose(qm, em)) self.assertTrue(np.allclose(m, em))
def create_from_eulers( eulers ): """Creates a matrix from the specified Euler rotations. :param numpy.array eulers: A set of euler rotations in the format specified by the euler modules. :rtype: numpy.array :return: A matrix with shape (4,4) with the euler's rotation. """ # set to identity matrix # this will populate our extra rows for us mat = create_identity() # we'll use Matrix33 for our conversion mat33 = mat[ 0:3, 0:3 ] mat[ 0:3, 0:3 ] = matrix33.create_from_eulers( eulers, mat33 ) return mat
def test_create_from_eulers(self): # just call the function # TODO: check the result matrix33.create_from_eulers([1, 2, 3])
def test_create_from_eulers(self): e = Vector3([1,2,3]) m = Matrix33.from_eulers(e) self.assertTrue(np.array_equal(m, matrix33.create_from_eulers([1,2,3])))
def test_create_from_eulers(self): # just call the function # TODO: check the result matrix33.create_from_eulers([1,2,3])