예제 #1
0
 def test_vectorize_rotation(self):
     epsilon = Rotation.from_random(self.n).as_matrix()
     epsilon_vec = np.reshape(epsilon, (self.n // 10, 10, 3, 3))
     for i, v in enumerate(
             np.reshape(
                 mechanics.rotation(epsilon_vec).as_matrix(),
                 mechanics.rotation(epsilon).as_matrix().shape)):
         assert np.allclose(rotation(epsilon[i]), v)
예제 #2
0
 def test_polar_decomposition(self):
     """F = RU = VR."""
     F = np.broadcast_to(np.eye(3), [self.n, 3, 3]) * np.random.rand(
         self.n, 3, 3)
     R = mechanics.rotation(F).as_matrix()
     V = mechanics.stretch_left(F)
     U = mechanics.stretch_right(F)
     assert np.allclose(np.matmul(R, U), np.matmul(V, R))
예제 #3
0
 def test_add_rotation(self, default):
     default.add_rotation('F')
     in_memory = mechanics.rotation(default.place('F')).as_matrix()
     in_file = default.place('R(F)')
     assert np.allclose(in_memory, in_file)