/// <summary> /// The clear. /// </summary> public void Clear() { version++; Spatial3DCell <T> .Pool(root); root = Spatial3DCell <T> .GetCell(center - initialSize / 2, initialSize); }
/// <summary> /// The shrink. /// </summary> private void Shrink() { Debug.Assert(CanShrink(), "The tree cannot be shrunk."); if (root.Children == null) { var sc = Spatial3DCell <T> .SubdivisionAmount; root.Size = root.Size / sc; root.Start = root.Start + root.Size * (sc / 2); } else { var middle = root.Children.Length / 2; var center = root.Children[middle]; root.Children[middle] = null; Spatial3DCell <T> .Pool(root); root = center; Debug.Assert(center != null); } }