public void LinkMinimalDirectedEdges(EdgeRing er) { // find first area edge (if any) to start linking at DirectedEdge firstOut = null; DirectedEdge incoming = null; int state = SCANNING_FOR_INCOMING; // link edges in CW order for (int i = resultAreaEdgeList.Count - 1; i >= 0; i--) { DirectedEdge nextOut = (DirectedEdge)resultAreaEdgeList[i]; DirectedEdge nextIn = nextOut.Sym; // record first outgoing edge, in order to link the last incoming edge if (firstOut == null && nextOut.EdgeRing == er) { firstOut = nextOut; } switch (state) { case SCANNING_FOR_INCOMING: if (nextIn.EdgeRing != er) { continue; } incoming = nextIn; state = LINKING_TO_OUTGOING; break; case LINKING_TO_OUTGOING: if (nextOut.EdgeRing != er) { continue; } incoming.NextMin = nextOut; state = SCANNING_FOR_INCOMING; break; } } if (state == LINKING_TO_OUTGOING) { Debug.Assert(firstOut != null, "found null for first outgoing dirEdge"); Debug.Assert(firstOut.EdgeRing == er, "unable to link last incoming dirEdge"); incoming.NextMin = firstOut; } }
/// <summary> /// Removes the element at the specified index of the <c>EdgeRingCollection</c>. /// </summary> /// <param name="index">The zero-based index of the element to remove.</param> /// <exception cref="ArgumentOutOfRangeException"> /// <para><paramref name="index"/> is less than zero</para> /// <para>-or-</para> /// <para><paramref name="index"/> is equal to or greater than <see cref="EdgeRingCollection.Count"/>.</para> /// </exception> public void RemoveAt(int index) { ValidateIndex(index); // throws m_count--; if (index < m_count) { Array.Copy(m_array, index + 1, m_array, index, m_count - index); } // We can't set the deleted entry equal to null, because it might be a value type. // Instead, we'll create an empty single-element array of the right type and copy it // over the entry we want to erase. EdgeRing[] temp = new EdgeRing[1]; Array.Copy(temp, 0, m_array, m_count, 1); m_version++; }
/// <summary> /// Inserts an element into the <c>EdgeRingCollection</c> at the specified index. /// </summary> /// <param name="index">The zero-based index at which <paramref name="item"/> should be inserted.</param> /// <param name="item">The <see cref="EdgeRing"/> to insert.</param> /// <exception cref="ArgumentOutOfRangeException"> /// <para><paramref name="index"/> is less than zero</para> /// <para>-or-</para> /// <para><paramref name="index"/> is equal to or greater than <see cref="EdgeRingCollection.Count"/>.</para> /// </exception> public void Insert(int index, EdgeRing item) { ValidateIndex(index, true); // throws if (m_count == m_array.Length) { EnsureCapacity(m_count + 1); } if (index < m_count) { Array.Copy(m_array, index, m_array, index + 1, m_count - index); } m_array[index] = item; m_count++; m_version++; }
public abstract void SetEdgeRing(DirectedEdge de, EdgeRing er);
public void AddHole(EdgeRing ring) { holes.Add(ring); }