public void Update() { _xAxisExtents.InsertionSort(comparisonMethodX); _yAxisExtents.InsertionSort(comparisonMethodY); for (int i = 0; i < _xAxisExtents.Count; i++) { e1 = _xAxisExtents[i]; if (e1.Type == ExtentType.Start) { HashSet <Extent> potentialCollisionsX = new HashSet <Extent>(); for (int j = i + 1; j < _xAxisExtents.Count && _xAxisExtents[j].Nucleus.ID != e1.Nucleus.ID; j++) { potentialCollisionsX.Add(_xAxisExtents[j]); } HashSet <Extent> potentialCollisionsY = new HashSet <Extent>(); for (int j = i + 1; j < _yAxisExtents.Count && _yAxisExtents[j].Nucleus.ID != e1.Nucleus.ID; j++) { potentialCollisionsY.Add(_yAxisExtents[j]); } List <Extent> probableCollisions = new List <Extent>(); foreach (Extent e in potentialCollisionsX) { if (potentialCollisionsY.Contains(e) && !probableCollisions.Contains(e) && e.Nucleus.ID != e1.Nucleus.ID) { probableCollisions.Add(e); } } foreach (Extent e2 in probableCollisions) { if (e1.Nucleus.DNCList.Contains(e2.Nucleus) || e2.Nucleus.DNCList.Contains(e1.Nucleus)) { continue; } NarrowPhase.DoCollision(e1.Nucleus, e2.Nucleus); } } } }