コード例 #1
0
ファイル: PlanarGraph.cs プロジェクト: izambakci/tf-net
 /// <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 void Add(DirectedEdge dirEdge)
 {
     dirEdges.Add(dirEdge);
 }
コード例 #2
0
ファイル: EdgeRing.cs プロジェクト: izambakci/tf-net
 /// <summary>
 /// Adds a DirectedEdge which is known to form part of this ring.
 /// </summary>
 /// <param name="de">The DirectedEdge to add.</param>
 public void Add(DirectedEdge de)
 {
     deList.Add(de);
 }
コード例 #3
0
ファイル: PlanarGraph.cs プロジェクト: izambakci/tf-net
 /// <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 void Remove(DirectedEdge de)
 {
     DirectedEdge sym = de.Sym;
     if (sym != null)
         sym.Sym = null;
     de.FromNode.OutEdges.Remove(de);
     de.Remove();
     dirEdges.Remove(de);
 }
コード例 #4
0
ファイル: DirectedEdgeStar.cs プロジェクト: izambakci/tf-net
 /// <summary>
 /// Adds a new member to this DirectedEdgeStar.
 /// </summary>
 /// <param name="de"></param>
 public void Add(DirectedEdge de)
 {
     outEdges.Add(de);
     sorted = false;
 }
コード例 #5
0
ファイル: LineSequencer.cs プロジェクト: izambakci/tf-net
 /// <summary>
 /// 
 /// </summary>
 /// <param name="de"></param>
 /// <param name="pos"></param>
 /// <param name="list"></param>
 /// <param name="expectedClosed"></param>
 /// <returns></returns>
 private LinkedListNode<DirectedEdge> AddReverseSubpath(DirectedEdge de, LinkedListNode<DirectedEdge> pos,
     LinkedList<DirectedEdge> list,  bool expectedClosed)
 {
     // trace an unvisited path *backwards* from this de
     Node endNode = de.ToNode;
     Node fromNode = null;
     while (true)
     {
         if (pos == null)
              pos = list.AddLast(de.Sym);
         else pos = list.AddAfter(pos, de.Sym);
         de.Edge.Visited = true;
         fromNode = de.FromNode;
         DirectedEdge unvisitedOutDE = FindUnvisitedBestOrientedDE(fromNode);
         // this must terminate, since we are continually marking edges as visited
         if (unvisitedOutDE == null)
             break;
         de = unvisitedOutDE.Sym;
     }
     if (expectedClosed)
     {
         // the path should end at the toNode of this de, otherwise we have an error
         Assert.IsTrue(fromNode == endNode, "path not contiguous");
     }
     return pos;
 }
コード例 #6
0
ファイル: DirectedEdgeStar.cs プロジェクト: izambakci/tf-net
 /// <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 DirectedEdge GetNextEdge(DirectedEdge dirEdge)
 {
     int i = GetIndex(dirEdge);
     return (DirectedEdge)outEdges[GetIndex(i + 1)];
 }
コード例 #7
0
ファイル: DirectedEdgeStar.cs プロジェクト: izambakci/tf-net
 /// <summary>
 /// Drops a member of this DirectedEdgeStar.
 /// </summary>
 /// <param name="de"></param>
 public void Remove(DirectedEdge de)
 {
     outEdges.Remove(de);
 }
コード例 #8
0
ファイル: DirectedEdgeStar.cs プロジェクト: izambakci/tf-net
 /// <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 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;
 }
コード例 #9
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 void Add(DirectedEdge dirEdge)
 {
     dirEdges.Add(dirEdge);
 }
コード例 #10
0
ファイル: Node.cs プロジェクト: izambakci/tf-net
 /// <summary>
 /// Adds an outgoing DirectedEdge to this Node.
 /// </summary>
 /// <param name="de"></param>
 public void AddOutEdge(DirectedEdge de)
 {
     deStar.Add(de);
 }
コード例 #11
0
ファイル: Edge.cs プロジェクト: izambakci/tf-net
 /// <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);
 }
コード例 #12
0
ファイル: Edge.cs プロジェクト: izambakci/tf-net
 /// <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 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);
 }