Ejemplo 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));
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void ClosestNeigbour_Test()
        {
            TestCloud2D set = new TestCloud2D();
            Octree      oct;

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

                Point closest = oct.ClosestNeighbour(set.Q4);
                Assert.AreEqual(set.ResultPoints_Q4_Closest(), closest);
            }
        }
Ejemplo n.º 3
0
        public void PointsInRange_Test()
        {
            TestCloud2D set = new TestCloud2D();
            Octree      oct = new Octree(set.Pts);

            Point[] inRange;

            // range 3 around Q1
            // =================

            inRange = oct.PointsInRange(set.Q1, 3).ToArray();

            // check for correct length
            Assert.AreEqual(set.ResultPoints_Q1_Range3().Length,
                            inRange.Length);

            foreach (Point expected in set.ResultPoints_Q1_Range3())
            {
                if (!inRange.Contains(expected))
                {
                    Assert.Fail(
                        "{0} is in range of 3 around Q1, but it has not been found.",
                        expected);
                }
            }

            // range 5 around Q2
            // =================

            inRange = oct.PointsInRange(set.Q2, 5).ToArray();

            // check for correct length
            Assert.AreEqual(set.ResultPoints_Q2_Range5().Length,
                            inRange.Length);

            foreach (Point expected in set.ResultPoints_Q2_Range5())
            {
                if (!inRange.Contains(expected))
                {
                    Assert.Fail(
                        "{0} is in range of 5 around Q2, but it has not been found.",
                        expected);
                }
            }
        }