private void Add(Edge edge, int geomIndex) { MonotoneChainEdge mce = edge.GetMonotoneChainEdge(); int[] startIndex = mce.StartIndex; for (int i = 0; i < startIndex.Length - 1; i++) { MonotoneChain mc = new MonotoneChain( mce, i, geomIndex ); SweepLineEvent insertEvent = new SweepLineEvent( geomIndex, mce.GetMinX(i), null, mc); _events.Add( insertEvent ); _events.Add( new SweepLineEvent( geomIndex, mce.GetMaxX(i), insertEvent, mc) ); } }
/// <summary> /// /// </summary> /// <param name="mc"></param> /// <param name="si"></param> public void ComputeIntersections(MonotoneChain mc, SegmentIntersector si) { _mce.ComputeIntersectsForChain(_chainIndex, mc.MonotoneChainEdge, mc.ChainIndex, si); }
private void ProcessOverlaps(int start, int end, MonotoneChain mc0, SegmentIntersector si, bool doMutualOnly) { // 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 = (SweepLineEvent) _events[i]; if ( ev.IsInsert ) { MonotoneChain mc1 = (MonotoneChain) ev.Object; if ( !doMutualOnly || ( mc0.GeomIndex != mc1.GeomIndex ) ) { mc0.ComputeIntersections( mc1, si ); _nOverlaps++; } } } // for ( int i = start; i < end; i++ ) }
/// <summary> /// /// </summary> /// <param name="mc"></param> /// <param name="si"></param> public void ComputeIntersections(MonotoneChain mc, SegmentIntersector si) { _mce.ComputeIntersectsForChain( _chainIndex, mc.MonotoneChainEdge, mc.ChainIndex, si); }