public LineListNode Get(Line line) { LineListNode cur = zero; while (cur.value != line) { cur = cur.next; } return(cur); }
public List <LineListNode> GetAsList() { LineListNode cur = zero.next; List <LineListNode> ret = new List <LineListNode>(); do { ret.Add(cur); cur = cur.next; }while(cur.value != zero.value); return(ret); }
// Adds an edge into the list, making sure it is in the correct place in the list so it is always sorted. public void AddSorted(Line edge, float edgeAngle) { Length++; if (zero == null) { zero = new LineListNode(edge, edgeAngle); } else { LineListNode cur = zero.next; while (edgeAngle - cur.angle > .000001 && cur != zero) { cur = cur.next; } LineListNode newLLN = new LineListNode(edge, cur, cur.prev, edgeAngle); cur.prev.next = newLLN; cur.prev = newLLN; } }
public LineListNode(Line v, LineListNode n, LineListNode p, float a) { value = v; next = n; prev = p; angle = a; }
public LineListNode(Line v, float a) { value = v; next = this; prev = this; angle = a; }
// Removes a vertex public void RemoveSorted(LineListNode l) { l.prev.next = l.next; l.next.prev = l.prev; l = null; }