示例#1
0
 def testMultipleRotates(self):
     r1 = matmath.xRotationMatrix(np.radians(90))
     r2 = matmath.zRotationMatrix(np.radians(90))
     mat = r1.dot(r2)
     pt = np.array([0, 0, 1, 1])
     npt = pt.dot(mat)
     np.testing.assert_almost_equal(npt, [1, 0, 0, 1])
示例#2
0
    def testQuaternionMatrix(self):
        q = matmath.axisAngleToQuaternion([1, 0, 0], np.radians(90))
        qmat = matmath.quaternionToRotationMatrix(q)
        rmat = matmath.xRotationMatrix(math.radians(90))
        np.testing.assert_almost_equal(qmat, rmat)

        q = matmath.axisAngleToQuaternion([0, 1, 0], np.radians(90))
        qmat = matmath.quaternionToRotationMatrix(q)
        rmat = matmath.yRotationMatrix(math.radians(90))
        np.testing.assert_almost_equal(qmat, rmat)

        q = matmath.axisAngleToQuaternion([0, 0, 1], np.radians(90))
        qmat = matmath.quaternionToRotationMatrix(q)
        rmat = matmath.zRotationMatrix(math.radians(90))
        np.testing.assert_almost_equal(qmat, rmat)
示例#3
0
 def testRotZ(self):
     pt = np.array([1, 0, 0, 1])
     mat = matmath.zRotationMatrix(math.radians(90))
     npt = pt.dot(mat)
     np.testing.assert_almost_equal(npt, [0, 1, 0, 1])