Example #1
0
        public void MostOrthogonalAxis()
        {
            Vector4I v1 = new Vector4I(1, 2, 3, 4);

            Assert.AreEqual(Vector4I.UnitX, v1.MostOrthogonalAxis);

            Vector4I v2 = new Vector4I(-3, -1, -2, -4);

            Assert.AreEqual(Vector4I.UnitY, v2.MostOrthogonalAxis);

            Vector4I v3 = new Vector4I(3, 2, 1, 4);

            Assert.AreEqual(Vector4I.UnitZ, v3.MostOrthogonalAxis);

            Vector4I v4 = new Vector4I(3, 2, 4, 1);

            Assert.AreEqual(Vector4I.UnitW, v4.MostOrthogonalAxis);
        }
Example #2
0
        public void Divide()
        {
            Vector4I v1 = new Vector4I(10, 20, 30, 40);

            Vector4I v2 = v1 / 5;

            Assert.AreEqual(2, v2.X);
            Assert.AreEqual(4, v2.Y);
            Assert.AreEqual(6, v2.Z);
            Assert.AreEqual(8, v2.W);

            Vector4I v3 = v1.Divide(5);

            Assert.AreEqual(2, v3.X);
            Assert.AreEqual(4, v3.Y);
            Assert.AreEqual(6, v3.Z);
            Assert.AreEqual(8, v3.W);
        }
Example #3
0
        public void Subtract()
        {
            Vector4I v1 = new Vector4I(1, 2, 3, 4);
            Vector4I v2 = new Vector4I(4, 5, 6, 7);

            Vector4I v3 = v1 - v2;

            Assert.AreEqual(-3, v3.X);
            Assert.AreEqual(-3, v3.Y);
            Assert.AreEqual(-3, v3.Z);
            Assert.AreEqual(-3, v3.W);

            Vector4I v4 = v1.Subtract(v2);

            Assert.AreEqual(-3, v4.X);
            Assert.AreEqual(-3, v4.Y);
            Assert.AreEqual(-3, v4.Z);
            Assert.AreEqual(-3, v4.W);
        }
Example #4
0
        public void Add()
        {
            Vector4I v1 = new Vector4I(1, 2, 3, 4);
            Vector4I v2 = new Vector4I(4, 5, 6, 7);

            Vector4I v3 = v1 + v2;

            Assert.AreEqual(5, v3.X);
            Assert.AreEqual(7, v3.Y);
            Assert.AreEqual(9, v3.Z);
            Assert.AreEqual(11, v3.W);

            Vector4I v4 = v1.Add(v2);

            Assert.AreEqual(5, v4.X);
            Assert.AreEqual(7, v4.Y);
            Assert.AreEqual(9, v4.Z);
            Assert.AreEqual(11, v4.W);
        }
Example #5
0
        public void Magnitude()
        {
            Vector4I v = new Vector4I(3, 4, 0, 0);

            Assert.AreEqual(25, v.MagnitudeSquared);
            Assert.AreEqual(5, v.Magnitude, 1e-14);

            v = new Vector4I(3, 0, 4, 0);
            Assert.AreEqual(25, v.MagnitudeSquared);
            Assert.AreEqual(5, v.Magnitude, 1e-14);

            v = new Vector4I(0, 3, 4, 0);
            Assert.AreEqual(25, v.MagnitudeSquared);
            Assert.AreEqual(5, v.Magnitude, 1e-14);

            v = new Vector4I(0, 0, 3, 4);
            Assert.AreEqual(25, v.MagnitudeSquared);
            Assert.AreEqual(5, v.Magnitude, 1e-14);
        }