Ejemplo n.º 1
0
            public void can_negate()
            {
                var actual   = new Vector4F(9.0f, -3, 17, -6);
                var expected = new Vector4F(-9.0f, 3, -17, 6);

                actual.Negate();

                Assert.Equal(expected, actual);
            }
Ejemplo n.º 2
0
        public void Negation()
        {
            Vector4F a = new Vector4F(1.0f, 2.0f, 3.0f, 4.0f);

            Assert.AreEqual(new Vector4F(-1.0f, -2.0f, -3.0f, -4.0f), Vector4F.Negate(a));
        }
Ejemplo n.º 3
0
        public void Negate()
        {
            Vector4F a = new Vector4F(1.0f, 2.0f, 3.0f, 4.0f);
            Vector4F negatedA1 = a.Negate();
            Assert.AreEqual(-1.0f, negatedA1.X, 1e-14);
            Assert.AreEqual(-2.0f, negatedA1.Y, 1e-14);
            Assert.AreEqual(-3.0f, negatedA1.Z, 1e-14);
            Assert.AreEqual(-4.0f, negatedA1.W, 1e-14);
            Vector4F negatedA2 = -a;
            Assert.AreEqual(-1.0f, negatedA2.X, 1e-14);
            Assert.AreEqual(-2.0f, negatedA2.Y, 1e-14);
            Assert.AreEqual(-3.0f, negatedA2.Z, 1e-14);
            Assert.AreEqual(-4.0f, negatedA2.W, 1e-14);

            Vector4F b = new Vector4F(-1.0f, -2.0f, -3.0f, -4.0f);
            Vector4F negatedB1 = b.Negate();
            Assert.AreEqual(1.0f, negatedB1.X, 1e-14);
            Assert.AreEqual(2.0f, negatedB1.Y, 1e-14);
            Assert.AreEqual(3.0f, negatedB1.Z, 1e-14);
            Assert.AreEqual(4.0f, negatedB1.W, 1e-14);
            Vector4F negatedB2 = -b;
            Assert.AreEqual(1.0f, negatedB2.X, 1e-14);
            Assert.AreEqual(2.0f, negatedB2.Y, 1e-14);
            Assert.AreEqual(3.0f, negatedB2.Z, 1e-14);
            Assert.AreEqual(4.0f, negatedB2.W, 1e-14);
        }