public void Clear_AllCellsEmpty() { var bin = new Bin3D <object>(9, 9, 9, 1, 1, 1); var results = new HashSet <object>(); var fullBounds = GetBoundsInsideCells(-1, -1, -1, bin.Width, bin.Height, bin.Depth, bin.CellWidth, bin.CellHeight, bin.CellDepth); bin.Retrieve(fullBounds, results); Assert.AreEqual(0, results.Count); }
public void Retrieve_Empty_NoResults() { var bin = new Bin3D <object>(9, 9, 9, 1, 1, 1); var rect = GetBoundsInsideCells(-1, -1, -1, bin.Width, bin.Height, bin.Depth, bin.CellWidth, bin.CellHeight, bin.CellDepth); var results = new HashSet <object>(); bin.Retrieve(rect, results); Assert.IsEmpty(results); }
public void Retrieve_CorrectResults(int minX, int minY, int minZ, int maxX, int maxY, int maxZ) { var bin = new Bin3D <object>(9, 9, 9, 1, 1, 1); var results = new HashSet <object>(); var val = new object(); var bounds = GetBoundsInsideCells(minX, minY, minZ, maxX, maxY, maxZ, bin.CellWidth, bin.CellHeight, bin.CellDepth); bin.Insert(val, bounds); bin.Retrieve(bounds, results); Assert.True(results.Contains(val)); }
public void Remove_RemovedFromCells() { var bin = new Bin3D <object>(9, 9, 9, 1, 1, 1); var results = new HashSet <object>(); var val = new object(); var bounds = GetBoundsInsideCells(3, 6, 4, 7, 8, 6, bin.CellWidth, bin.CellHeight, bin.CellDepth); bin.Insert(val, bounds); bin.Remove(val, bounds); bin.Retrieve(bounds, results); Assert.False(results.Contains(val)); }