public LSeg(PMQTree o, IHasLine v) { m_nodes = new LinkedList <LNode>(); m_v = v; m_o = o; m_keyval = m_o.segKey(); }
/// Insert a new value and return a handle to it public IIndexedSeg Insert(IHasLine val) { if (val == null || val.LineSeg == null) { throw new Exception("WTFERY,it's null!!"); } LSeg r = new LSeg(this, val); m_allsegs[r.Keyval] = r; m_root.Insert(r); return(r); }
/// In-place split an existing line segment into two parts. public Pair <IIndexedSeg, IIndexedSeg> Split(IIndexedSeg tosplit, IHasLine a, IHasLine b) { LSeg l = tosplit as LSeg; Pair <LSeg, LSeg> r = l.DoSplit(a, b); m_allsegs[r.First.Keyval] = r.First; m_allsegs[r.Second.Keyval] = r.Second; m_allsegs.Remove(l.Keyval); return(new Pair <IIndexedSeg, IIndexedSeg>(r.First, r.Second)); }
public Pair <IIndexedSeg, IIndexedSeg> Split(IIndexedSeg tosplit, IHasLine a, IHasLine b) { Handle na = new Handle(m_segments.AddFirst(a)); Handle nb = new Handle(m_segments.AddFirst(b)); Handle h = tosplit as Handle; m_segments.Remove(h.Node); return(new Pair <IIndexedSeg, IIndexedSeg>(na, nb)); }
public Pair <LSeg, LSeg> DoSplit(IHasLine a, IHasLine b) { LSeg ar = new LSeg(m_o, a); LSeg br = new LSeg(m_o, b); List <LNode> thenodes = new List <LNode>(m_nodes); foreach (LNode n in thenodes) { n.RemoveLSeg(this); if (n.Intersects(a.LineSeg)) { n.AddSeg(ar); } if (n.Intersects(b.LineSeg)) { n.AddSeg(br); } //n.CheckSplit(); } return(new Pair <LSeg, LSeg>(ar, br)); }
public IIndexedSeg Insert(IHasLine v) { return(new Handle(m_segments.AddFirst(v))); }