• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Matrix44类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Matrix44的典型用法代码示例。如果您正苦于以下问题:C# Matrix44类的具体用法?C# Matrix44怎么用?C# Matrix44使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Matrix44类属于命名空间,在下文中一共展示了Matrix44类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: mul

        public void mul(Matrix44 other)
        {
            float []result;

            result = new float[16];

            result[0 + 0*4] = Matrix44.vectorDot4(array[0 + 0*4], array[1 + 0*4], array[2 + 0*4], array[3 + 0*4], other.array[0 + 0*4], other.array[0 + 1*4], other.array[0 + 2*4], other.array[0 + 3*4]);
            result[1 + 0*4] = Matrix44.vectorDot4(array[0 + 0*4], array[1 + 0*4], array[2 + 0*4], array[3 + 0*4], other.array[1 + 0*4], other.array[1 + 1*4], other.array[1 + 2*4], other.array[1 + 3*4]);
            result[2 + 0*4] = Matrix44.vectorDot4(array[0 + 0*4], array[1 + 0*4], array[2 + 0*4], array[3 + 0*4], other.array[2 + 0*4], other.array[2 + 1*4], other.array[2 + 2*4], other.array[2 + 3*4]);
            result[3 + 0*4] = Matrix44.vectorDot4(array[0 + 0*4], array[1 + 0*4], array[2 + 0*4], array[3 + 0*4], other.array[3 + 0*4], other.array[3 + 1*4], other.array[3 + 2*4], other.array[3 + 3*4]);

            result[0 + 1*4] = Matrix44.vectorDot4(array[0 + 1*4], array[1 + 1*4], array[2 + 1*4], array[3 + 1*4], other.array[0 + 0*4], other.array[0 + 1*4], other.array[0 + 2*4], other.array[0 + 3*4]);
            result[1 + 1*4] = Matrix44.vectorDot4(array[0 + 1*4], array[1 + 1*4], array[2 + 1*4], array[3 + 1*4], other.array[1 + 0*4], other.array[1 + 1*4], other.array[1 + 2*4], other.array[1 + 3*4]);
            result[2 + 1*4] = Matrix44.vectorDot4(array[0 + 1*4], array[1 + 1*4], array[2 + 1*4], array[3 + 1*4], other.array[2 + 0*4], other.array[2 + 1*4], other.array[2 + 2*4], other.array[2 + 3*4]);
            result[3 + 1*4] = Matrix44.vectorDot4(array[0 + 1*4], array[1 + 1*4], array[2 + 1*4], array[3 + 1*4], other.array[3 + 0*4], other.array[3 + 1*4], other.array[3 + 2*4], other.array[3 + 3*4]);

            result[0 + 2*4] = Matrix44.vectorDot4(array[0 + 2*4], array[1 + 2*4], array[2 + 2*4], array[3 + 2*4], other.array[0 + 0*4], other.array[0 + 1*4], other.array[0 + 2*4], other.array[0 + 3*4]);
            result[1 + 2*4] = Matrix44.vectorDot4(array[0 + 2*4], array[1 + 2*4], array[2 + 2*4], array[3 + 2*4], other.array[1 + 0*4], other.array[1 + 1*4], other.array[1 + 2*4], other.array[1 + 3*4]);
            result[2 + 2*4] = Matrix44.vectorDot4(array[0 + 2*4], array[1 + 2*4], array[2 + 2*4], array[3 + 2*4], other.array[2 + 0*4], other.array[2 + 1*4], other.array[2 + 2*4], other.array[2 + 3*4]);
            result[3 + 2*4] = Matrix44.vectorDot4(array[0 + 2*4], array[1 + 2*4], array[2 + 2*4], array[3 + 2*4], other.array[3 + 0*4], other.array[3 + 1*4], other.array[3 + 2*4], other.array[3 + 3*4]);

            result[0 + 3*4] = Matrix44.vectorDot4(array[0 + 3*4], array[1 + 3*4], array[2 + 3*4], array[3 + 3*4], other.array[0 + 0*4], other.array[0 + 1*4], other.array[0 + 2*4], other.array[0 + 3*4]);
            result[1 + 3*4] = Matrix44.vectorDot4(array[0 + 3*4], array[1 + 3*4], array[2 + 3*4], array[3 + 3*4], other.array[1 + 0*4], other.array[1 + 1*4], other.array[1 + 2*4], other.array[1 + 3*4]);
            result[2 + 3*4] = Matrix44.vectorDot4(array[0 + 3*4], array[1 + 3*4], array[2 + 3*4], array[3 + 3*4], other.array[2 + 0*4], other.array[2 + 1*4], other.array[2 + 2*4], other.array[2 + 3*4]);
            result[3 + 3*4] = Matrix44.vectorDot4(array[0 + 3*4], array[1 + 3*4], array[2 + 3*4], array[3 + 3*4], other.array[3 + 0*4], other.array[3 + 1*4], other.array[3 + 2*4], other.array[3 + 3*4]);

            array = result;
        }
开发者ID:PtrMan,项目名称:ai2,代码行数:28,代码来源:Matrix44.cs


示例2: Transform

 public static Vector4 Transform(Vector4 v, Matrix44 m)
 {
     Vector4 vector4_1 = new Vector4();
     for (int index = 0; index < 4; ++index)
         vector4_1[index] = (float)((double)v[0] * (double)m[0][index] + (double)v[1] * (double)m[1][index] + (double)v[2] * (double)m[2][index] + (double)v[3] * (double)m[3][index]);
     Vector4 vector4_2;
     (vector4_2 = vector4_1)[0] = vector4_2[0] / vector4_1[3];
     Vector4 vector4_3;
     (vector4_3 = vector4_1)[1] = vector4_3[1] / vector4_1[3];
     Vector4 vector4_4;
     (vector4_4 = vector4_1)[2] = vector4_4[2] / vector4_1[3];
     return vector4_1;
 }
开发者ID:SaveScum,项目名称:skyrim-plugin-decoding-project,代码行数:13,代码来源:Vector4.cs


示例3: TestOperator_Addition_iv

        public void TestOperator_Addition_iv ()
        {
            for(Int32 i = 0; i < 100; ++i)
            {
                var a = GetNextRandomMatrix44();
                var b = GetNextRandomMatrix44();

                var expected = new Matrix44(
                    a.R0C0 + b.R0C0,
                    a.R0C1 + b.R0C1,
                    a.R0C2 + b.R0C2,
                    a.R0C3 + b.R0C3,
                    a.R1C0 + b.R1C0,
                    a.R1C1 + b.R1C1,
                    a.R1C2 + b.R1C2,
                    a.R1C3 + b.R1C3,
                    a.R2C0 + b.R2C0,
                    a.R2C1 + b.R2C1,
                    a.R2C2 + b.R2C2,
                    a.R2C3 + b.R2C3,
                    a.R3C0 + b.R3C0,
                    a.R3C1 + b.R3C1,
                    a.R3C2 + b.R3C2,
                    a.R3C3 + b.R3C3
                    );

                this.TestAddition(a, b, expected);
            }
        }
开发者ID:sungiant,项目名称:abacus,代码行数:29,代码来源:Abacus.Double.Tests.cs


示例4: ICall_Material_SetValueMatrix44

 private static extern void ICall_Material_SetValueMatrix44(MaterialInstance self, String paramName, ref Matrix44 value);
开发者ID:icegbq,项目名称:Genesis-3D,代码行数:1,代码来源:MaterialInstance_register.cs


示例5: Render

        internal void Render(Graphics zGfx, String pass, Matrix44 zView, Matrix44 zProjection)
        {
            if (!passState.ContainsKey (pass))
                return;

            zGfx.SetCullMode (CullMode.None);
            zGfx.SetActive ((VertexBuffer)null);
            zGfx.SetActive ((IndexBuffer)null);
            zGfx.SetActive ((Texture)null, 0);
            shader.SetVariable ("View", zView);
            shader.SetVariable ("Projection", zProjection);
            zGfx.SetActive (shader, VertexPositionTextureColour.Default.VertexDeclaration);

            _render_batch(zGfx, pass);
        }
开发者ID:dreamsxin,项目名称:engine-1,代码行数:15,代码来源:PrimitiveRenderer.cs


示例6: TestOperator_Multiplication_ii

        public void TestOperator_Multiplication_ii ()
        {
            for(Int32 i = 0; i < 100; ++i)
            {
                var a = GetNextRandomMatrix44();
                var b = GetNextRandomMatrix44();

                var c = new Matrix44(
                    (a.R0C0 * b.R0C0) + (a.R0C1 * b.R1C0) +
                    (a.R0C2 * b.R2C0) + (a.R0C3 * b.R3C0),
                    (a.R0C0 * b.R0C1) + (a.R0C1 * b.R1C1) +
                    (a.R0C2 * b.R2C1) + (a.R0C3 * b.R3C1),
                    (a.R0C0 * b.R0C2) + (a.R0C1 * b.R1C2) +
                    (a.R0C2 * b.R2C2) + (a.R0C3 * b.R3C2),
                    (a.R0C0 * b.R0C3) + (a.R0C1 * b.R1C3) +
                    (a.R0C2 * b.R2C3) + (a.R0C3 * b.R3C3),
                    (a.R1C0 * b.R0C0) + (a.R1C1 * b.R1C0) +
                    (a.R1C2 * b.R2C0) + (a.R1C3 * b.R3C0),
                    (a.R1C0 * b.R0C1) + (a.R1C1 * b.R1C1) +
                    (a.R1C2 * b.R2C1) + (a.R1C3 * b.R3C1),
                    (a.R1C0 * b.R0C2) + (a.R1C1 * b.R1C2) +
                    (a.R1C2 * b.R2C2) + (a.R1C3 * b.R3C2),
                    (a.R1C0 * b.R0C3) + (a.R1C1 * b.R1C3) +
                    (a.R1C2 * b.R2C3) + (a.R1C3 * b.R3C3),
                    (a.R2C0 * b.R0C0) + (a.R2C1 * b.R1C0) +
                    (a.R2C2 * b.R2C0) + (a.R2C3 * b.R3C0),
                    (a.R2C0 * b.R0C1) + (a.R2C1 * b.R1C1) +
                    (a.R2C2 * b.R2C1) + (a.R2C3 * b.R3C1),
                    (a.R2C0 * b.R0C2) + (a.R2C1 * b.R1C2) +
                    (a.R2C2 * b.R2C2) + (a.R2C3 * b.R3C2),
                    (a.R2C0 * b.R0C3) + (a.R2C1 * b.R1C3) +
                    (a.R2C2 * b.R2C3) + (a.R2C3 * b.R3C3),
                    (a.R3C0 * b.R0C0) + (a.R3C1 * b.R1C0) +
                    (a.R3C2 * b.R2C0) + (a.R3C3 * b.R3C0),
                    (a.R3C0 * b.R0C1) + (a.R3C1 * b.R1C1) +
                    (a.R3C2 * b.R2C1) + (a.R3C3 * b.R3C1),
                    (a.R3C0 * b.R0C2) + (a.R3C1 * b.R1C2) +
                    (a.R3C2 * b.R2C2) + (a.R3C3 * b.R3C2),
                    (a.R3C0 * b.R0C3) + (a.R3C1 * b.R1C3) +
                    (a.R3C2 * b.R2C3) + (a.R3C3 * b.R3C3));

                this.TestMultiplication(a, b, c);
            }
        }
开发者ID:sungiant,项目名称:abacus,代码行数:44,代码来源:Abacus.Double.Tests.cs


示例7: TestMultiplication

        // Test Operator: Multiplication //-----------------------------------//

        /// <summary>
        /// Helper method for testing multiplication.
        /// </summary>
        void TestMultiplication (Matrix44 a, Matrix44 b, Matrix44 expected )
        {
            // This test asserts the following:
            //   a * b == expected

            Matrix44 result_1b; Matrix44.Multiply(ref a, ref b, out result_1b);
            Assert.That(result_1b, Is.EqualTo(expected));

#if (VARIANTS_ENABLED)
            var result_1a = a * b;
            Assert.That(result_1a, Is.EqualTo(expected));
#endif
        }
开发者ID:sungiant,项目名称:abacus,代码行数:18,代码来源:Abacus.Double.Tests.cs


示例8: TestOperator_Negation_i

        public void TestOperator_Negation_i ()
        {
            Double r = 3432;
            Double s = -6218;
            Double t = -3432;
            Double u = 6218;

            var a = new Matrix44(
                r, s, t, u,
                r, s, t, u,
                r, s, t, u,
                r, s, t, u);

            var b = new Matrix44(
                u, t, s, r,
                u, t, s, r,
                u, t, s, r,
                u, t, s, r);

            var c = new Matrix44(
                t, u, r, s,
                t, u, r, s,
                t, u, r, s,
                t, u, r, s);

            var d = new Matrix44(
                s, r, u, t,
                s, r, u, t,
                s, r, u, t,
                s, r, u, t);

            this.TestNegation(a, c);
            this.TestNegation(b, d);
        }
开发者ID:sungiant,项目名称:abacus,代码行数:34,代码来源:Abacus.Double.Tests.cs


示例9: TestOperator_Subtraction_iii

        public void TestOperator_Subtraction_iii ()
        {
            for(Int32 i = 0; i < 100; ++i)
            {
                var a = GetNextRandomMatrix44();
                var b = GetNextRandomMatrix44();

                var expected = new Matrix44(
                    a.R0C0 - b.R0C0,
                    a.R0C1 - b.R0C1,
                    a.R0C2 - b.R0C2,
                    a.R0C3 - b.R0C3,
                    a.R1C0 - b.R1C0,
                    a.R1C1 - b.R1C1,
                    a.R1C2 - b.R1C2,
                    a.R1C3 - b.R1C3,
                    a.R2C0 - b.R2C0,
                    a.R2C1 - b.R2C1,
                    a.R2C2 - b.R2C2,
                    a.R2C3 - b.R2C3,
                    a.R3C0 - b.R3C0,
                    a.R3C1 - b.R3C1,
                    a.R3C2 - b.R3C2,
                    a.R3C3 - b.R3C3
                    );

                this.TestSubtraction(a, b, expected);
            }
        }
开发者ID:sungiant,项目名称:abacus,代码行数:29,代码来源:Abacus.Double.Tests.cs


示例10: TestStaticFn_Transpose_i

        public void TestStaticFn_Transpose_i ()
        {
            Matrix44 startMatrix = new Matrix44(
                0, 1, 2, 3,
                4, 5, 6, 7,
                8, 9, 10, 11,
                12, 13, 14, 15);

            Matrix44 testMatrix = startMatrix;

            Matrix44 testMatrixExpectedTranspose = new Matrix44(
                0, 4, 8, 12,
                1, 5, 9, 13,
                2, 6, 10, 14,
                3, 7, 11, 15);

            // RUN THE STATIC VERSION OF THE FUNCTION
            Matrix44 resultMatrix = Matrix44.Identity;

            Matrix44.Transpose(ref testMatrix, out resultMatrix);

            Assert.That(resultMatrix, Is.EqualTo(testMatrixExpectedTranspose));
        }
开发者ID:sungiant,项目名称:abacus,代码行数:23,代码来源:Abacus.Double.Tests.cs


示例11: TestStaticFn_CreateFromQuaternion_ii

        public void TestStaticFn_CreateFromQuaternion_ii ()
        {
            Quaternion q = new Quaternion (
                (Double) (-0.163863438188094),
                (Double) (0.7106071968472370),
                (Double) (0.6722283804612080),
                (Double) (-0.127652614217613));

            Matrix44 m; Matrix44.CreateFromQuaternion(ref q, out m);

            Matrix44 expected = new Matrix44 ();
            expected.R0C0 = (Double) (-0.9137071674171720);
            expected.R0C1 = (Double) (-0.4045084971874740);
            expected.R0C2 = (Double) (-0.0388855746211755);
            expected.R0C3 = 0;

            expected.R1C0 = (Double) (-0.0612616567188929);
            expected.R1C1 = (Double)  (0.0425155562553572);
            expected.R1C2 = (Double)  (0.9972158426801860);
            expected.R1C3 = 0;

            expected.R2C0 = (Double) (-0.4017290400587740);
            expected.R2C1 = (Double)  (0.9135454576426010);
            expected.R2C2 = (Double) (-0.0636276291718221);
            expected.R2C3 = 0;

            expected.R3C0 = 0;
            expected.R3C1 = 0;
            expected.R3C2 = 0;
            expected.R3C3 = 1;

            AssertEqualWithinReason (m, expected);
        }
开发者ID:sungiant,项目名称:abacus,代码行数:33,代码来源:Abacus.Double.Tests.cs


示例12: TestStaticFn_CreateFromQuaternion_i

        public void TestStaticFn_CreateFromQuaternion_i ()
        {
            Double yaw; Maths.Pi(out yaw); yaw /= (Double) 4;
            Double pitch; Maths.Pi(out pitch); pitch /= (Double) (-8);
            Double roll; Maths.Pi(out roll); roll /= (Double) 2;

            Quaternion q; Quaternion.CreateFromYawPitchRoll(ref yaw, ref pitch, ref roll, out q);
            q.Normalise();

            Matrix44 m; Matrix44.CreateFromQuaternion(ref q, out m);

            Matrix44 expected = new Matrix44 ();
            expected.R0C0 = (Double) (-0.270598);
            expected.R0C1 = (Double) 0.9238795;
            expected.R0C2 = (Double) (-0.270598);
            expected.R0C3 = 0;

            expected.R1C0 = (Double) (-0.7071067);
            expected.R1C1 = 0;
            expected.R1C2 = (Double) 0.7071067;
            expected.R1C3 = 0;

            expected.R2C0 = (Double) 0.6532815;
            expected.R2C1 = (Double) 0.3826834;
            expected.R2C2 = (Double) 0.6532815;
            expected.R2C3 = 0;

            expected.R3C0 = 0;
            expected.R3C1 = 0;
            expected.R3C2 = 0;
            expected.R3C3 = 1;

            AssertEqualWithinReason (m, expected);
        }
开发者ID:sungiant,项目名称:abacus,代码行数:34,代码来源:Abacus.Double.Tests.cs


示例13: TestConstant_Identity_i

        public void TestConstant_Identity_i ()
        {
            Matrix44 result = Matrix44.Identity;
            Matrix44 expected = new Matrix44 (
                1, 0, 0, 0, 
                0, 1, 0, 0, 
                0, 0, 1, 0, 
                0, 0, 0, 1);

            AssertEqualWithinReason(result, expected);
        }        [Test]
开发者ID:sungiant,项目名称:abacus,代码行数:11,代码来源:Abacus.Double.Tests.cs


示例14: TestMemberFn_ToString

        public void TestMemberFn_ToString ()
        {
            Matrix44 a = new Matrix44(
                42, -17, 13, -44,
                46, -23, -22, 90,
                34, -21, 52, 33,
                88, -12, -78, 50);

            String result = a.ToString();

            String expected =
                "{ " +
                "{R0C0:42 R0C1:-17 R0C2:13 R0C3:-44} " +
                "{R1C0:46 R1C1:-23 R1C2:-22 R1C3:90} " +
                "{R2C0:34 R2C1:-21 R2C2:52 R2C3:33} " +
                "{R3C0:88 R3C1:-12 R3C2:-78 R3C3:50} " +
                "}";

            Assert.That(result, Is.EqualTo(expected));
        }
开发者ID:sungiant,项目名称:abacus,代码行数:20,代码来源:Abacus.Double.Tests.cs


示例15: Test_Constructors

        public void Test_Constructors ()
        {
            {
                // Test default values
                Matrix44 a = new Matrix44();
                Assert.That(a, Is.EqualTo(Matrix44.Zero));
            }
            {
                Double a = -18759;
                Double b = 345;
                Double c = 774;
                Double d = -3431;
                Double e = -55;
                Double f = 47;
                Double g = 45;
                Double h = 3461;
                Double i = -4;
                Double j = 453;
                Double k = -3;
                Double l = -3441;
                Double m = -189;
                Double n = 5;
                Double o = -87;
                Double p = 341;

                Matrix44 expected = new Matrix44(
                    a, b, c, d,
                    e, f, g, h,
                    i, j, k, l,
                    m, n, o, p);

                Assert.That(expected.R0C0, Is.EqualTo(a));
                Assert.That(expected.R0C1, Is.EqualTo(b));
                Assert.That(expected.R0C2, Is.EqualTo(c));
                Assert.That(expected.R0C3, Is.EqualTo(d));
                Assert.That(expected.R1C0, Is.EqualTo(e));
                Assert.That(expected.R1C1, Is.EqualTo(f));
                Assert.That(expected.R1C2, Is.EqualTo(g));
                Assert.That(expected.R1C3, Is.EqualTo(h));
                Assert.That(expected.R2C0, Is.EqualTo(i));
                Assert.That(expected.R2C1, Is.EqualTo(j));
                Assert.That(expected.R2C2, Is.EqualTo(k));
                Assert.That(expected.R2C3, Is.EqualTo(l));
                Assert.That(expected.R3C0, Is.EqualTo(m));
                Assert.That(expected.R3C1, Is.EqualTo(n));
                Assert.That(expected.R3C2, Is.EqualTo(o));
                Assert.That(expected.R3C3, Is.EqualTo(p));
            }
        }
开发者ID:sungiant,项目名称:abacus,代码行数:49,代码来源:Abacus.Double.Tests.cs


示例16: AssertEqualWithinReason

        /// <summary>
        /// Helper to encapsulate asserting that two Matrix44s are equal.
        /// </summary>
        internal static void AssertEqualWithinReason (Matrix44 a, Matrix44 b)
        {
            Double tolerance;
            MathsTests.TestTolerance(out tolerance);

            Assert.That(a.R0C0, Is.EqualTo(b.R0C0).Within(tolerance));
            Assert.That(a.R0C1, Is.EqualTo(b.R0C1).Within(tolerance));
            Assert.That(a.R0C2, Is.EqualTo(b.R0C2).Within(tolerance));
            Assert.That(a.R0C3, Is.EqualTo(b.R0C3).Within(tolerance));

            Assert.That(a.R1C0, Is.EqualTo(b.R1C0).Within(tolerance));
            Assert.That(a.R1C1, Is.EqualTo(b.R1C1).Within(tolerance));
            Assert.That(a.R1C2, Is.EqualTo(b.R1C2).Within(tolerance));
            Assert.That(a.R1C3, Is.EqualTo(b.R1C3).Within(tolerance));

            Assert.That(a.R2C0, Is.EqualTo(b.R2C0).Within(tolerance));
            Assert.That(a.R2C1, Is.EqualTo(b.R2C1).Within(tolerance));
            Assert.That(a.R2C2, Is.EqualTo(b.R2C2).Within(tolerance));
            Assert.That(a.R2C3, Is.EqualTo(b.R2C3).Within(tolerance));

            Assert.That(a.R3C0, Is.EqualTo(b.R3C0).Within(tolerance));
            Assert.That(a.R3C1, Is.EqualTo(b.R3C1).Within(tolerance));
            Assert.That(a.R3C2, Is.EqualTo(b.R3C2).Within(tolerance));
            Assert.That(a.R3C3, Is.EqualTo(b.R3C3).Within(tolerance));
        }
开发者ID:sungiant,项目名称:abacus,代码行数:28,代码来源:Abacus.Double.Tests.cs


示例17: TestSubtraction

        // Test Operator: Subtraction //--------------------------------------//

        /// <summary>
        /// Helper method for testing subtraction.
        /// </summary>
        void TestSubtraction (Matrix44 a, Matrix44 b, Matrix44 expected )
        {
            // This test asserts the following:
            //   a - b == expected
            //   b - a == -expected

            var result_1a = a - b;
            var result_2a = b - a;

            Matrix44 result_1b; Matrix44.Subtract(ref a, ref b, out result_1b);
            Matrix44 result_2b; Matrix44.Subtract(ref b, ref a, out result_2b);

            Assert.That(result_1a, Is.EqualTo(expected));
            Assert.That(result_2a, Is.EqualTo(-expected));
            Assert.That(result_1b, Is.EqualTo(expected));
            Assert.That(result_2b, Is.EqualTo(-expected));
        }
开发者ID:sungiant,项目名称:abacus,代码行数:22,代码来源:Abacus.Double.Tests.cs


示例18: TestOperator_Subtraction_i

        public void TestOperator_Subtraction_i ()
        {
            var a = new Matrix44(
                12, -4, 14, 18,
                44, -6, -2, -11,
                34, 54, 4, 5,
                4, -6, 2, 2);

            var b = new Matrix44(
                15, 11, 7, 27,
                4, 1, -4, 11,
                3, 21, -22, 19,
                6, -5, 23, 11);

            var expected = new Matrix44(
                -3, -15, 7, -9,
                40, -7, 2, -22,
                31, 33, 26, -14,
                -2, -1, -21, -9);

            this.TestSubtraction(a, b, expected);

            var c = new Matrix44(
                -423, 342, 7, -800,
                44, -54, -22, 11,
                44, -54, -22, 11,
                44, -54, -22, 11);

            this.TestSubtraction(c, Matrix44.Zero, c);
        }
开发者ID:sungiant,项目名称:abacus,代码行数:30,代码来源:Abacus.Double.Tests.cs


示例19: TestEquality

        // Test Operator: Equality //-----------------------------------------//

        /// <summary>
        /// Helper method for testing equality.
        /// </summary>
        void TestEquality (Matrix44 a, Matrix44 b, Boolean expected )
        {
            // This test asserts the following:
            //   (a == b) == expected
            //   (b == a) == expected
            //   (a != b) == !expected
            //   (b != a) == !expected

            Boolean result_1a = (a == b);
            Boolean result_1b = (a.Equals(b));
            Boolean result_1c = (a.Equals((Object)b));

            Boolean result_2a = (b == a);
            Boolean result_2b = (b.Equals(a));
            Boolean result_2c = (b.Equals((Object)a));

            Boolean result_3a = (a != b);
            Boolean result_4a = (b != a);

            Assert.That(result_1a, Is.EqualTo(expected));
            Assert.That(result_1b, Is.EqualTo(expected));
            Assert.That(result_1c, Is.EqualTo(expected));
            Assert.That(result_2a, Is.EqualTo(expected));
            Assert.That(result_2b, Is.EqualTo(expected));
            Assert.That(result_2c, Is.EqualTo(expected));
            Assert.That(result_3a, Is.EqualTo(!expected));
            Assert.That(result_4a, Is.EqualTo(!expected));
        }
开发者ID:sungiant,项目名称:abacus,代码行数:33,代码来源:Abacus.Double.Tests.cs


示例20: TestNegation

        // Test Operator: Negation //-----------------------------------------//

        /// <summary>
        /// Helper method for testing negation.
        /// </summary>
        void TestNegation (Matrix44 a, Matrix44 expected )
        {
            // This test asserts the following:
            //   -a == expected

            var result_1a = -a;

            Matrix44 result_1b;
            Matrix44.Negate(ref a, out result_1b);

            Assert.That(result_1a, Is.EqualTo(expected));
            Assert.That(result_1b, Is.EqualTo(expected));
        }
开发者ID:sungiant,项目名称:abacus,代码行数:18,代码来源:Abacus.Double.Tests.cs



注:本文中的Matrix44类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Matrix4F类代码示例发布时间:2022-05-24
下一篇:
C# Matrix4类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap