Esempio n. 1
0
            public void can_divide_vector()
            {
                var actual   = new Vector4F(3.0f, -2.0f, 8.0f, 1.5f);
                var expected = new Vector4F(3.0f / 4.0f, -2.0f / 4.0f, 8.0f / 4.0f, 1.5f / 4.0f);

                actual.Divide(4);

                Assert.Equal(expected, actual);
            }
Esempio n. 2
0
        public void Division()
        {
            float x = 23.4f;
            float y = -11.0f;
            float z = 7.0f;
            float w = 1.9f;
            float s = 13.3f;

            Vector4F v = new Vector4F(x, y, z, w);
            Vector4F u = Vector4F.Divide(v, s);

            Assert.IsTrue(Numeric.AreEqual(x / s, u.X));
            Assert.IsTrue(Numeric.AreEqual(y / s, u.Y));
            Assert.IsTrue(Numeric.AreEqual(z / s, u.Z));
            Assert.IsTrue(Numeric.AreEqual(w / s, u.W));
        }
Esempio n. 3
0
        public void DivisionVector()
        {
            float x1 = 23.4f;
            float y1 = -11.0f;
            float z1 = 6.0f;
            float w1 = 0.2f;

            float x2 = 34.0f;
            float y2 = 1.2f;
            float z2 = -6.0f;
            float w2 = -0.2f;

            Vector4F v = new Vector4F(x1, y1, z1, w1);
            Vector4F w = new Vector4F(x2, y2, z2, w2);

            Assert.AreEqual(new Vector4F(x1 / x2, y1 / y2, z1 / z2, w1 / w2), Vector4F.Divide(v, w));
        }
Esempio n. 4
0
        public void Divide()
        {
            Vector4F v1 = new Vector4F(10.0f, 20.0f, 30.0f, 40.0f);

            Vector4F v2 = v1 / 5.0f;
            Assert.AreEqual(2.0f, v2.X, 1e-14);
            Assert.AreEqual(4.0f, v2.Y, 1e-14);
            Assert.AreEqual(6.0f, v2.Z, 1e-14);
            Assert.AreEqual(8.0f, v2.W, 1e-14);

            Vector4F v3 = v1.Divide(5.0f);
            Assert.AreEqual(2.0f, v3.X, 1e-14);
            Assert.AreEqual(4.0f, v3.Y, 1e-14);
            Assert.AreEqual(6.0f, v3.Z, 1e-14);
            Assert.AreEqual(8.0f, v3.W, 1e-14);
        }