Abacus.DoublePrecision.Vector4Tests.TestStaticFn_Normalise_ii C# (CSharp) Method

TestStaticFn_Normalise_ii() private method

private TestStaticFn_Normalise_ii ( ) : void
return void
        public void TestStaticFn_Normalise_ii ()
        {
            Double epsilon; Maths.Epsilon(out epsilon);

            for( Int32 i = 0; i < 100; ++ i)
            {
                Vector4 a = GetNextRandomVector4();

                Vector4 b; Vector4.Normalise(ref a, out b);
                Double expected = 1;
                Double result1 = b.Length();
                Assert.That(result1, Is.EqualTo(expected).Within(epsilon));

                // The normalise function takes both a ref and out parameter,
                // need to check that if we pass in the same value as both
                // parameters we get the same results.
                Vector4 c = a;
                Vector4.Normalise(ref c, out c);
                Double result2 = c.Length();
                Assert.That(result2, Is.EqualTo(expected).Within(epsilon));
            }
        }
Vector4Tests