Accord.Tests.Math.AForgeToolsTest.DirectionTest C# (CSharp) Method

DirectionTest() private method

private DirectionTest ( ) : void
return void
        public void DirectionTest()
        {
            IntPoint center = new IntPoint(0, 0);

            IntPoint w = new IntPoint(1, 0);
            IntPoint nw = new IntPoint(1, 1);
            IntPoint n = new IntPoint(0, 1);
            IntPoint ne = new IntPoint(-1, 1);
            IntPoint e = new IntPoint(-1, 0);
            IntPoint se = new IntPoint(-1, -1);
            IntPoint s = new IntPoint(0, -1);
            IntPoint sw = new IntPoint(1, -1);


            int actual;
            int expected;

            actual = Accord.Math.Tools.Direction(center, w);
            expected = (int)System.Math.Floor(0 / 18.0);
            Assert.AreEqual(expected, actual);

            actual = Accord.Math.Tools.Direction(center, nw);
            expected = (int)System.Math.Floor(45 / 18.0);
            Assert.AreEqual(expected, actual);

            actual = Accord.Math.Tools.Direction(center, n);
            expected = (int)System.Math.Floor(90 / 18.0);
            Assert.AreEqual(expected, actual);

            actual = Accord.Math.Tools.Direction(center, ne);
            expected = (int)System.Math.Floor(135 / 18.0);
            Assert.AreEqual(expected, actual);

            actual = Accord.Math.Tools.Direction(center, e);
            expected = (int)System.Math.Floor(180 / 18.0);
            Assert.AreEqual(expected, actual);

            actual = Accord.Math.Tools.Direction(center, se);
            expected = (int)System.Math.Floor(225 / 18.0);
            Assert.AreEqual(expected, actual);

            actual = Accord.Math.Tools.Direction(center, s);
            expected = (int)System.Math.Floor(270 / 18.0);
            Assert.AreEqual(expected, actual);

            actual = Accord.Math.Tools.Direction(center, sw);
            expected = (int)System.Math.Floor(315 / 18.0);
            Assert.AreEqual(expected, actual);
        }