Пример #1
0
 def test_create_from_matrix44_translation_dtype_matches(self):
     mat = np.array([
         [
             1.,
             2.,
             3.,
             4.,
         ],
         [
             5.,
             6.,
             7.,
             8.,
         ],
         [
             9.,
             10.,
             11.,
             12.,
         ],
         [
             13.,
             14.,
             15.,
             16.,
         ],
     ],
                    dtype=np.float32)
     result = vector3.create_from_matrix44_translation(mat)
     np.testing.assert_almost_equal(result, [13., 14., 15.], decimal=5)
     self.assertTrue(result.dtype == np.float32)
Пример #2
0
 def test_create_from_matrix44_translation_dtype_matches(self):
     mat = np.array([
         [1.,2.,3.,4.,],
         [5.,6.,7.,8.,],
         [9.,10.,11.,12.,],
         [13.,14.,15.,16.,],
     ], dtype=np.float32)
     result = vector3.create_from_matrix44_translation(mat)
     np.testing.assert_almost_equal(result, [13.,14.,15.], decimal=5)
     self.assertTrue(result.dtype == np.float32)
Пример #3
0
def test_translation( unittest, transform, vector ):
    # Object space
    unittest.assertTrue(
        numpy.allclose( transform.translation, vector ),
        "Translation Vector incorrect"
        )

    # check the matrix translation matches the transform
    matrix_trans = vector3.create_from_matrix44_translation( transform.matrix )
    unittest.assertTrue(
        numpy.allclose( matrix_trans, vector ),
        "Translation Matrix incorrect"
        )