///<summary> /// Removes a <see cref="DirectedEdge"/> incident on this node. Does not change the state of the directed edge. ///</summary> public void Remove(DirectedEdge de) { deStar.Remove(de); }
/// <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); }
public void testDirectedEdgeToEdges() { var d1 = new DirectedEdge(new Node(new Coordinate(0, 0)), new Node(new Coordinate(10, 10)), new Coordinate(10, 10), true); var d2 = new DirectedEdge(new Node(new Coordinate(20, 0)), new Node(new Coordinate(20, 10)), new Coordinate(20, 10), false); var edges = DirectedEdge.ToEdges(new List<DirectedEdge> (new []{d1, d2})); Assert.AreEqual(2, edges.Count); Assert.IsNull(edges[0]); Assert.IsNull(edges[1]); }
/// <summary> /// Adds an outgoing DirectedEdge to this Node. /// </summary> /// <param name="de"></param> public void AddOutEdge(DirectedEdge de) { deStar.Add(de); }
private static 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; 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; }
public void testDirectedEdgeComparator() { var d1 = new DirectedEdge(new Node(new Coordinate(0, 0)), new Node(new Coordinate(10, 10)), new Coordinate(10, 10), true); var d2 = new DirectedEdge(new Node(new Coordinate(0, 0)), new Node(new Coordinate(20, 20)), new Coordinate(20, 20), false); Assert.AreEqual(0, d2.CompareTo(d1)); }
/// <summary> /// Removes a <see cref="DirectedEdge"/> from its from-<see cref="Node"/> and from this PlanarGraph. /// </summary> /// <remarks> /// This method does not remove the <see cref="Node"/>s associated with the DirectedEdge, /// even if the removal of the DirectedEdge reduces the degree of a Node to zero. /// </remarks> /// <param name="de"></param> public void Remove(DirectedEdge de) { DirectedEdge sym = de.Sym; if (sym != null) sym.Sym = null; de.FromNode.Remove(de); de.Remove(); dirEdges.Remove(de); }
/// <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); }
/* /// <summary> /// Constructs a DirectedEdgeStar with no edges. /// </summary> public DirectedEdgeStar() { } */ /// <summary> /// Adds a new member to this DirectedEdgeStar. /// </summary> /// <param name="de"></param> public void Add(DirectedEdge de) { _outEdges.Add(de); _sorted = false; }
/// <summary> /// Drops a member of this DirectedEdgeStar. /// </summary> /// <param name="de"></param> public void Remove(DirectedEdge de) { _outEdges.Remove(de); }
///<summary> /// Returns the <see cref="DirectedEdge"/> on the right-hand (CW) /// side of the given <see cref="DirectedEdge"/> /// (which must be a member of this DirectedEdgeStar). /// </summary> public DirectedEdge GetNextCWEdge(DirectedEdge dirEdge) { int i = GetIndex(dirEdge); return _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 int GetIndex(DirectedEdge dirEdge) { SortEdges(); for (int i = 0; i < _outEdges.Count; i++) { DirectedEdge de = _outEdges[i]; if (de == dirEdge) return i; } return -1; }