Exemplo n.º 1
0
        public void TestAddTranslation()
        {
            //managed operation
            Vector3   point         = new Vector3(1f, -1f, 0.5f);
            Matrix3x4 matrix34      = new Matrix3x4(0f, 1f, 2f, 3f, 10f, 11f, 12f, 13f, 20f, 21f, 22f, 23f);
            Matrix3x4 managedMatrix = matrix34;

            Assert.IsTrue(!ReferenceEquals(matrix34, managedMatrix));
            managedMatrix.AddTranslation(point);

            //native operation
            Vec3     point2       = new Vec3(point.x, point.y, point.z);
            Matrix34 nativeMatrix = new Matrix34(0f, 1f, 2f, 3f, 10f, 11f, 12f, 13f, 20f, 21f, 22f, 23f);

            nativeMatrix.AddTranslation(point2);

            Assert.That(nativeMatrix.m00, Is.EqualTo(managedMatrix[0, 0]));
            Assert.That(nativeMatrix.m01, Is.EqualTo(managedMatrix[0, 1]));
            Assert.That(nativeMatrix.m02, Is.EqualTo(managedMatrix[0, 2]));
            Assert.That(nativeMatrix.m03, Is.EqualTo(managedMatrix[0, 3]));
            Assert.That(nativeMatrix.m10, Is.EqualTo(managedMatrix[1, 0]));
            Assert.That(nativeMatrix.m11, Is.EqualTo(managedMatrix[1, 1]));
            Assert.That(nativeMatrix.m12, Is.EqualTo(managedMatrix[1, 2]));
            Assert.That(nativeMatrix.m13, Is.EqualTo(managedMatrix[1, 3]));
            Assert.That(nativeMatrix.m20, Is.EqualTo(managedMatrix[2, 0]));
            Assert.That(nativeMatrix.m21, Is.EqualTo(managedMatrix[2, 1]));
            Assert.That(nativeMatrix.m22, Is.EqualTo(managedMatrix[2, 2]));
            Assert.That(nativeMatrix.m23, Is.EqualTo(managedMatrix[2, 3]));
        }
Exemplo n.º 2
0
        public void TestAddTranslation()
        {
            //managed operation
            Vector3   point     = new Vector3(1f, -1f, 0.5f);
            Matrix3x4 matrix34  = new Matrix3x4(0f, 1f, 2f, 3f, 10f, 11f, 12f, 13f, 20f, 21f, 22f, 23f);
            Matrix3x4 newMatrix = matrix34;

            Assert.IsTrue(!ReferenceEquals(matrix34, newMatrix));
            newMatrix.AddTranslation(point);

            //native operation
            Vec3     point2       = new Vec3(point.x, point.y, point.z);
            Matrix34 nativeMatrix = new Matrix34(0f, 1f, 2f, 3f, 10f, 11f, 12f, 13f, 20f, 21f, 22f, 23f);

            nativeMatrix.AddTranslation(point2);

            Assert.IsTrue(newMatrix == nativeMatrix);
        }