Exemple #1
0
    def test_from_rodrigues(self):
        rod_list_1 = [0, 0, 0]

        r1 = RotationD(rod_list_1)
        numpy.testing.assert_equal(r1.rodrigues(), rod_list_1)

        # This one will get normalized by magnitude in rotation instance
        # This vector's is less than 2*pi, so we should expect this vector to be
        #   returned as is.
        rod2 = numpy.array([2, -1, 0.5])
        nod2_normed = array_normalize(rod2)
        print("r2 2-norm:", numpy.linalg.norm(rod2))
        print("r2-normed:", nod2_normed)

        r2 = RotationD(rod2)
        numpy.testing.assert_array_almost_equal(
            r2.rodrigues(), rod2, decimal=14,  # 1e-14
        )
Exemple #2
0
    def test_to_rodrigues(self):
        # rodrigues identity: [0,0,0]
        ident_rod = [0, 0, 0]

        rot_d = RotationD()
        rot_f = RotationF()

        rod = rot_d.rodrigues()
        numpy.testing.assert_equal(rod, ident_rod)

        rod = rot_f.rodrigues()
        numpy.testing.assert_equal(rod, ident_rod)