Abacus.DoublePrecision.Vector2Tests.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)
            {
                Vector2 a = GetNextRandomVector2();

                Vector2 b; Vector2.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.
                Vector2 c = a;
                Vector2.Normalise(ref c, out c);
                Double result2 = c.Length();
                Assert.That(result2, Is.EqualTo(expected).Within(epsilon));
            }
        }
Vector2Tests