/// <summary> /// /// </summary> /// <param name="action"></param> public virtual void ComputeOverlaps(ISweepLineOverlapAction action) { _nOverlaps = 0; BuildIndex(); for (int i = 0; i < _events.Count; i++) { SweepLineEvent ev = (SweepLineEvent)_events[i]; if (ev.IsInsert) ProcessOverlaps(i, ev.DeleteEventIndex, ev.Interval, action); } }
/// <summary> /// /// </summary> /// <param name="action"></param> public void ComputeOverlaps(ISweepLineOverlapAction action) { _nOverlaps = 0; BuildIndex(); for (int i = 0; i < _events.Count; i++) { SweepLineEvent ev = _events[i]; if (ev.IsInsert) ProcessOverlaps(i, ev.DeleteEventIndex, ev.Interval, action); } }
} // private void BuildIndex() /// <summary> /// /// </summary> /// <param name="action"></param> public void ComputeOverlaps(ISweepLineOverlapAction action) { _nOverlaps = 0; BuildIndex(); for (int i = 0; i < _events.Count; i++) { SweepLineEvent ev = (SweepLineEvent)_events[i]; SweepLineInterval sweepInt = ev.Interval; if (ev.IsInsert) { ProcessOverlaps(i, ev.DeleteEventIndex, sweepInt, action); } } // for ( int i = 0; i < _events.Count; i++ ) } // public void ComputeOverlaps( SweepLineOverlapAction action )
/// <summary> /// /// </summary> /// <param name="start"></param> /// <param name="end"></param> /// <param name="s0"></param> /// <param name="action"></param> private void ProcessOverlaps(int start, int end, SweepLineInterval s0, ISweepLineOverlapAction action) { /* * Since we might need to test for self-intersections, * include current insert event object in list of event objects to test. * Last index can be skipped, because it must be a Delete event. */ for (int i = start; i < end; i++) { SweepLineEvent ev = _events[i]; if (ev.IsInsert) { SweepLineInterval s1 = ev.Interval; action.Overlap(s0, s1); _nOverlaps++; } } }
} // private void BuildIndex() /// <summary> /// /// </summary> /// <param name="action"></param> public void ComputeOverlaps( ISweepLineOverlapAction action ) { _nOverlaps = 0; BuildIndex(); for ( int i = 0; i < _events.Count; i++ ) { SweepLineEvent ev = (SweepLineEvent) _events[i]; SweepLineInterval sweepInt = ev.Interval; if ( ev.IsInsert ) { ProcessOverlaps( i, ev.DeleteEventIndex, sweepInt, action ); } } // for ( int i = 0; i < _events.Count; i++ ) } // public void ComputeOverlaps( SweepLineOverlapAction action )