Example #1
0
        public void Multiplication()
        {
            float x = 23.4f;
            float y = -11.0f;
            float z = 6.0f;
            float w = 0.4f;
            float s = 13.3f;

            Vector4F v = new Vector4F(x, y, z, w);

            Vector4F u = Vector4F.Multiply(s, v);

            Assert.AreEqual(x * s, u.X);
            Assert.AreEqual(y * s, u.Y);
            Assert.AreEqual(z * s, u.Z);
            Assert.AreEqual(w * s, u.W);
        }
Example #2
0
        public void MultiplicationVector()
        {
            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.Multiply(v, w));
        }
Example #3
0
        public void Multiply()
        {
            Vector4F v1 = new Vector4F(1.0f, 2.0f, 3.0f, 4.0f);

            Vector4F v2 = v1 * 5.0f;
            Assert.AreEqual(5.0f, v2.X, 1e-14);
            Assert.AreEqual(10.0f, v2.Y, 1e-14);
            Assert.AreEqual(15.0f, v2.Z, 1e-14);
            Assert.AreEqual(20.0f, v2.W, 1e-14);

            Vector4F v3 = 5.0f * v1;
            Assert.AreEqual(5.0f, v3.X, 1e-14);
            Assert.AreEqual(10.0f, v3.Y, 1e-14);
            Assert.AreEqual(15.0f, v3.Z, 1e-14);
            Assert.AreEqual(20.0f, v3.W, 1e-14);

            Vector4F v4 = v1.Multiply(5.0f);
            Assert.AreEqual(5.0f, v4.X, 1e-14);
            Assert.AreEqual(10.0f, v4.Y, 1e-14);
            Assert.AreEqual(15.0f, v4.Z, 1e-14);
            Assert.AreEqual(20.0f, v4.W, 1e-14);
        }