public void InsertMany() { 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 1", boundingBox); tree.Add("test object 2", boundingBox); tree.Add("test object 3", boundingBox); tree.Add("test object 4", boundingBox); var list = tree.QueryRange(boundingBox); Assert.AreEqual(4, list.Count); Assert.AreEqual("test object 1", list[0]); Assert.AreEqual("test object 2", list[1]); Assert.AreEqual("test object 3", list[2]); Assert.AreEqual("test object 4", list[3]); }
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))); }