예제 #1
0
 /// <summary>
 /// Initializes this Edge's two DirectedEdges, and for each DirectedEdge: sets the
 /// Edge, sets the symmetric DirectedEdge, and adds this Edge to its from-Node.
 /// </summary>
 /// <param name="de0"></param>
 /// <param name="de1"></param>
 public virtual void SetDirectedEdges(DirectedEdge de0, DirectedEdge de1)
 {
     dirEdge = new DirectedEdge[] { de0, de1, };
     de0.Edge = this;
     de1.Edge = this;
     de0.Sym = de1;
     de1.Sym = de0;
     de0.FromNode.AddOutEdge(de0);
     de1.FromNode.AddOutEdge(de1);
 }
 /// <summary>
 /// Drops a member of this DirectedEdgeStar.
 /// </summary>
 /// <param name="de"></param>
 public virtual void Remove(DirectedEdge de)
 {
     outEdges.Remove(de);
 }
 /// <summary>
 /// Adds a new member to this DirectedEdgeStar.
 /// </summary>
 /// <param name="de"></param>
 public virtual void Add(DirectedEdge de)
 {            
     outEdges.Add(de);
     sorted = false;
 }
 /// <summary>
 /// Returns the DirectedEdge on the left-hand side of the given DirectedEdge (which
 /// must be a member of this DirectedEdgeStar). 
 /// </summary>
 /// <param name="dirEdge"></param>
 /// <returns></returns>
 public virtual DirectedEdge GetNextEdge(DirectedEdge dirEdge)
 {
     int i = GetIndex(dirEdge);
     return (DirectedEdge)outEdges[GetIndex(i + 1)];
 }
 /// <summary>
 /// Returns the zero-based index of the given DirectedEdge, after sorting in ascending order
 /// by angle with the positive x-axis.
 /// </summary>
 /// <param name="dirEdge"></param>
 /// <returns></returns>
 public virtual int GetIndex(DirectedEdge dirEdge)
 {
     SortEdges();
     for (int i = 0; i < outEdges.Count; i++)
     {
         DirectedEdge de = (DirectedEdge)outEdges[i];
         if (de == dirEdge)
             return i;
     }
     return -1;
 }
예제 #6
0
 /// <summary>
 /// Adds an outgoing DirectedEdge to this Node.
 /// </summary>
 /// <param name="de"></param>
 public virtual void AddOutEdge(DirectedEdge de)
 {
     deStar.Add(de);
 }
예제 #7
0
 /// <summary>
 /// Adds the Edge to this PlanarGraph; only subclasses can add DirectedEdges,
 /// to ensure the edges added are of the right class.
 /// </summary>
 /// <param name="dirEdge"></param>
 protected virtual void Add(DirectedEdge dirEdge)
 {
     _dirEdges.Add(dirEdge);
 }
예제 #8
0
 /// <summary> 
 /// Removes DirectedEdge from its from-Node and from this PlanarGraph. Note:
 /// This method does not remove the Nodes associated with the DirectedEdge,
 /// even if the removal of the DirectedEdge reduces the degree of a Node to
 /// zero.
 /// </summary>
 /// <param name="de"></param>
 public virtual void Remove(DirectedEdge de)
 {
     DirectedEdge sym = de.Sym;
     if (sym != null) 
         sym.Sym = null;
     de.FromNode.OutEdges.Remove(de);
     de.Remove();
     _dirEdges.Remove(de);
 }
예제 #9
0
 /// <summary>
 /// Adds a DirectedEdge which is known to form part of this ring.
 /// </summary>
 /// <param name="de">The DirectedEdge to add.</param>
 public virtual void Add(DirectedEdge de)
 {
     _deList.Add(de);
 }
예제 #10
0
 /// <summary>
 /// Constructs an Edge initialized with the given DirectedEdges, and for each
 /// DirectedEdge: sets the Edge, sets the symmetric DirectedEdge, and adds
 /// this Edge to its from-Node.
 /// </summary>
 /// <param name="de0"></param>
 /// <param name="de1"></param>
 public Edge(DirectedEdge de0, DirectedEdge de1)
 {
     SetDirectedEdges(de0, de1);
 }