Esempio n. 1
0
 def test_rotation_matrix_trivial(self):
     np.testing.assert_almost_equal(
         MathUtils.rotation_matrix(0),
         np.eye(2)
         )
     np.testing.assert_almost_equal(
         MathUtils.rotation_matrix(math.pi / 2),
         np.array([[0,-1],[1,0]])
         )
     np.testing.assert_almost_equal(
         MathUtils.rotation_matrix(math.pi),
         np.array([[-1,0],[0,-1]])
         )
     np.testing.assert_almost_equal(
         MathUtils.rotation_matrix(3*math.pi/2),
         np.array([[0,1],[-1,0]])
         )
Esempio n. 2
0
 def test_rotation_matrix_equivalence(self, radians, n_2pi):
     np.testing.assert_almost_equal(
         MathUtils.rotation_matrix(radians),
         MathUtils.rotation_matrix(radians+n_2pi*math.pi*2)
         )