Пример #1
0
        public void Subtraction()
        {
            Vector4F a = new Vector4F(1.0f, 2.0f, 3.0f, 4.0f);
            Vector4F b = new Vector4F(10.0f, -10.0f, 0.5f, 2.5f);
            Vector4F c = Vector4F.Subtract(a, b);

            Assert.AreEqual(new Vector4F(-9.0f, 12.0f, 2.5f, 1.5f), c);
        }
Пример #2
0
            public void subtracting_vectors_leaves_right_unchanged()
            {
                var left          = new Vector4F(1.0f, 2, 3, 4);
                var right         = new Vector4F(3.0f, 4, 5, 6);
                var expectedRight = new Vector4F(right);

                left.Subtract(right);

                Assert.Equal(expectedRight, right);
            }
Пример #3
0
            public void subtracting_vector_subtracts_from_components()
            {
                var actual   = new Vector4F(1.0f, 15, 5, 3);
                var right    = new Vector4F(3.0f, 4, 10, 1);
                var expected = new Vector4F(-2.0f, 11, -5, 2);

                actual.Subtract(right);

                Assert.Equal(expected, actual);
            }
Пример #4
0
        public void Subtract()
        {
            Vector4F v1 = new Vector4F(1.0f, 2.0f, 3.0f, 4.0f);
            Vector4F v2 = new Vector4F(4.0f, 5.0f, 6.0f, 7.0f);

            Vector4F v3 = v1 - v2;
            Assert.AreEqual(-3.0f, v3.X, 1e-14);
            Assert.AreEqual(-3.0f, v3.Y, 1e-14);
            Assert.AreEqual(-3.0f, v3.Z, 1e-14);
            Assert.AreEqual(-3.0f, v3.W, 1e-14);

            Vector4F v4 = v1.Subtract(v2);
            Assert.AreEqual(-3.0f, v4.X, 1e-14);
            Assert.AreEqual(-3.0f, v4.Y, 1e-14);
            Assert.AreEqual(-3.0f, v4.Z, 1e-14);
            Assert.AreEqual(-3.0f, v4.W, 1e-14);
        }