Esempio n. 1
0
        public void InsertOne()
        {
            var boundingBox = BoundingBox.ByCorners(Point.ByCoordinates(0, 0, 0), Point.ByCoordinates(1, 1, 1));
            var tree        = new SimpleOctree(boundingBox, new OctreeOptions());

            tree.Add("test object", boundingBox);
            var list = tree.QueryRange(boundingBox);

            Assert.AreEqual(1, list.Count);
            Assert.AreEqual("test object", list[0]);
        }
        public void SetUpOctree()
        {
            var boundingBox = BoundingBox.ByCorners(Point.ByCoordinates(0, 0, 0), Point.ByCoordinates(10, 10, 10));

            tree = new SimpleOctree(boundingBox, new OctreeOptions());

            // Create octree with eight objects, one in each first-level cell
            tree.Add("test object 1", BoundingBox.ByCorners(Point.ByCoordinates(1, 1, 1), Point.ByCoordinates(4, 4, 4)));
            tree.Add("test object 2", BoundingBox.ByCorners(Point.ByCoordinates(1, 6, 1), Point.ByCoordinates(4, 9, 4)));
            tree.Add("test object 3", BoundingBox.ByCorners(Point.ByCoordinates(6, 1, 1), Point.ByCoordinates(9, 4, 4)));
            tree.Add("test object 4", BoundingBox.ByCorners(Point.ByCoordinates(6, 6, 1), Point.ByCoordinates(9, 9, 4)));
            tree.Add("test object 5", BoundingBox.ByCorners(Point.ByCoordinates(1, 1, 6), Point.ByCoordinates(4, 4, 9)));
            tree.Add("test object 6", BoundingBox.ByCorners(Point.ByCoordinates(1, 6, 6), Point.ByCoordinates(4, 9, 9)));
            tree.Add("test object 7", BoundingBox.ByCorners(Point.ByCoordinates(6, 1, 6), Point.ByCoordinates(9, 4, 9)));
            tree.Add("test object 8", BoundingBox.ByCorners(Point.ByCoordinates(6, 6, 6), Point.ByCoordinates(9, 9, 9)));
        }