Exemplo n.º 1
0
        public void GetRotationMatrixTest()
        {
#if NET
            var matrix = NMatrix4.Identity;
#else
            var matrix = Matrix4.Identity;
#endif
            var V3 = new Vector3(1, 0, 0);

            using (var obj = new MDLTransform(matrix)) {
                obj.SetRotation(V3, 0);
                var expected = new MatrixFloat4x4(
                    1, 0, 0, 0,
                    0, (float)Math.Cos(1.0f), (float)-Math.Sin(1.0f), 0,
                    0, (float)Math.Sin(1.0f), (float)Math.Cos(1.0f), 0,
                    0, 0, 0, 1
                    );
#if NET
                Asserts.AreEqual(expected, obj.GetRotationMatrix(0), 0.00001f, "GetRotationMatrix");
#else
                Asserts.AreEqual((Matrix4)MatrixFloat4x4.Transpose(expected), obj.GetRotationMatrix(0), 0.00001f, "GetRotationMatrix");
                Asserts.AreEqual(expected, obj.GetRotationMatrix4x4(0), 0.00001f, "GetRotationMatrix4x4");
#endif
                Asserts.AreEqual(expected, CFunctions.MDLTransform_GetRotationMatrix(obj, 0), 0.00001f, "GetRotationMatrix4x4 native");
            }
        }