private void SplitHulls(WorkBuffer <PartialHull> hulls, Event e) { var splitIdx = BinarySearch.LE(hulls.Data, e, FindSplit.Default, 0, hulls.UsedSize - 1); var hull = hulls.Data[splitIdx]; var upperIds = hull.UpperIds; var x = upperIds.Data[upperIds.UsedSize - 1]; hull.UpperIds = new WorkBuffer <int>(8); hull.UpperIds.Push(ref x); var h = hulls.Insert(splitIdx + 1); h.A = e.A; h.B = e.B; h.Index = e.Index; h.LowerIds.Clear(); h.LowerIds.Push(ref x); h.UpperIds = upperIds; if (Verbose) { Debug.Log("Split: " + splitIdx); DumpHulls(hulls); hulls.Dump(); } }