Ejemplo n.º 1
0
 public LSeg(PMQTree o, IHasLine v)
 {
     m_nodes  = new LinkedList <LNode>();
     m_v      = v;
     m_o      = o;
     m_keyval = m_o.segKey();
 }
Ejemplo n.º 2
0
        /// 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);
        }
Ejemplo n.º 3
0
        /// 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));
        }
Ejemplo n.º 4
0
        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));
        }
Ejemplo n.º 5
0
            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));
            }
Ejemplo n.º 6
0
 public IIndexedSeg Insert(IHasLine v)
 {
     return(new Handle(m_segments.AddFirst(v)));
 }