Esempio n. 1
0
        public void ClosestNeighbours_Test()
        {
            TestCloud2D set = new TestCloud2D();
            Octree      oct;

            for (int i = 0; i < 5; i++)
            {
                oct = new Octree(set.Pts, i);

                Point[] closest3 = oct.ClosestNeighbours(set.Q3, 3).ToArray();
                Assert.AreEqual(3, closest3.Length, 0,
                                string.Format(
                                    "Not the correct Amount: Exp: 3, Found: {0} (i = {1})",
                                    closest3.Length, i)
                                );

                foreach (Point expected in set.ResultPoints_Q3_Closest3())
                {
                    if (!closest3.Contains(expected))
                    {
                        Assert.Fail(String.Format(
                                        "{0} is one of the closest 3 around Q1, but was not found!",
                                        expected));
                    }
                }
            }
        }