예제 #1
0
        public bool Is_in_polygon(LinkList <PO> pl, PO p0)
        {
            //由pl指定一个封闭多边形,测试p0是否在多边形中,是返回true,否返回false;
            float     sum = 0;
            util      u1  = new util();
            Node <PO> pnt = pl.Head;

            while (pnt.Next != null)
            {
                sum += Edge_Test_Fun(pnt.Data, pnt.Next.Data, p0);
                pnt  = pnt.Next;
            }
            sum += Edge_Test_Fun(pnt.Data, pl.Head.Data, p0);
            if (System.Math.Abs(sum) > 6)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #2
0
        public void Initial(model2d m)
        {
            //m从生成某个模型的点集中获取包含一个初始面的点集
            util u1 = new util();
            PO   p0, p1;
            LINE l1;

            //获取初始面的三个顶点和一个初始面
            p0 = m.pi;
            p1 = m.pj;
            //加入初始的点,构成初始点集
            p0.selected = true;
            p1.selected = true;
            work_pl.Insert(p0);
            work_pl.Insert(p1);
            //产生初始三角形的一条边
            l1 = new LINE(p0, p1);
            //为每个点加入初始的边集
            p0.ll.Insert(l1);
            p1.ll.Insert(l1);
            pl = m.Get_p_l();        //获取模型的点数据,为一个点链
            PAINT.GetLL(l1);
        }
예제 #3
0
        public void SearchPoint(int num)
        {
            //Delaunay算法的主函数,遍历边链的每一条边,并分别进行处理
            util      u1 = new util();
            Node <PO> pt = work_pl.Head;

            info.Insert("--start SearchPoint--");
            for (int i = 0; i < 10; i++)
            {
                loc = i;
                if (pt == null)
                {
                    break;
                }
                info.Insert("----step:" + i + "-----");
                pkey = pt.Data;
                Output(pkey);
                pre_l = pt.Data.ll;
                SearchLine();
                pt = pt.Next;
            }
            info.Insert("--SearchPoint end--");
        }
예제 #4
0
        public void SearchPoint_next_step()
        {
            //Delaunay算法的主函数,遍历边链的每一条边,并分别进行处理
            util      u1 = new util();
            Node <PO> pt = Where_pointer;

            info.Insert("--start SearchPOint_next_step--");
            if (pt == null)
            {
                return;
            }
            loc++;
            info.Insert(":" + "-------" + loc + "----------");
            pkey = pt.Data;
            pt.Data.ToPrint(info);//输出当前需要处理的点
            pre_l = pt.Data.ll;
            SearchLine();
            PEBIGrid(pt.Data);
            pt            = pt.Next;
            Where_pointer = pt;
            PAINT.p_tags  = pkey;
            PAINT.pl      = pl;
            info.Insert("--SearchPOint_next_step end--");
        }
예제 #5
0
 public void ToPrint(LinkList <String> infost)
 {
     infost.Insert(":" + '(' + x + ',' + y + ',' + z + ')');
 }
예제 #6
0
 public void SetPL(LinkList <PO> pl)
 {
     pl_tag = pl;
     return;
 }
예제 #7
0
        private void shadowpo(PO shap, PO shapflag, PO pap, PO papflag)
        {
            /*
             * 将影子点的边转移到父点中去
             * shap是影子点,shapflag是影子点的标记点
             * pap是父点,papflag是父点的标记点
             */

            if (pap.ll.Head.Data.Po_insideme(papflag))
            {//如果标记点在父点的首边上
                if (shap.ll.Head.Data.Po_insideme(shapflag))
                {
                    #region case1
                    Node <LINE> lnt = shap.ll.Head;
                    while (lnt != null)
                    {
                        //用父点换掉边中的影子点
                        lnt.Data.Po_insideme_and_changeit(pap);
                        pap.ll.Head_Insert(lnt.Data);
                        lnt = lnt.Next;
                    }
                    #endregion case1
                }
                else
                {
                    #region case2
                    LinkList <LINE> lt  = new LinkList <LINE>();
                    Node <LINE>     lnt = shap.ll.Head;
                    while (lnt != null)//将shap的线链反序
                    {
                        lt.Head_Insert(lnt.Data);
                        lnt = lnt.Next;
                    }
                    lnt = lt.Head;
                    while (lnt != null)
                    {
                        lnt.Data.Po_insideme_and_changeit(pap);
                        pap.ll.Head_Insert(lnt.Data);
                        lnt = lnt.Next;
                    }
                    #endregion case2
                }
            }
            else
            {//如果标记点在父点的尾边上
                if (shap.ll.Head.Data.Po_insideme(shapflag))
                {
                    #region case3
                    Node <LINE> lnt = shap.ll.Head;
                    while (lnt != null)
                    {
                        lnt.Data.Po_insideme_and_changeit(pap);
                        pap.ll.Insert(lnt.Data);
                        lnt = lnt.Next;
                    }
                    #endregion case3
                }
                else
                {
                    #region case4
                    LinkList <LINE> lt  = new LinkList <LINE>();
                    Node <LINE>     lnt = shap.ll.Head;
                    while (lnt != null)//将shap的线链反序
                    {
                        lt.Head_Insert(lnt.Data);
                        lnt = lnt.Next;
                    }
                    lnt = lt.Head;
                    while (lnt != null)
                    {
                        lnt.Data.Po_insideme_and_changeit(pap);
                        pap.ll.Insert(lnt.Data);
                        lnt = lnt.Next;
                    }
                    #endregion case4
                }
            }
            work_pl.Delete(shap);
        }
예제 #8
0
 public LinkList <PO> work_pl;         //表示当前工作的点链集
 public Delaunay_2D()
 {
     //初始化工作边集
     work_pl = new LinkList <PO>();
 }
예제 #9
0
        private void Shadow_Delete(LINE lpa, PO lpa_pk, LINE lshadow, PO ls_pk)
        {
            /*
             * 将影子点的边转移到父点中去
             * shap是影子点,shapflag是影子点的标记点
             * pap是父点,papflag是父点的标记点
             */
            util u1 = new util();

            if (lpa.sl.Head.Data.Belongme(lpa_pk))
            {//如果标记点在父点的首边上
                if (lshadow.sl.Head.Data.Belongme(ls_pk))
                {
                    info.Insert("case1");
                    #region case1
                    Node <SURFACE> sn = lshadow.sl.Head;
                    while (sn != null)
                    {
                        //用父点换掉边中的影子点
                        lpa.sl.Head_Insert(sn.Data);
                        sn = sn.Next;
                    }
                    #endregion case1
                }
                else
                {
                    info.Insert("case2");
                    #region case2
                    LinkList <SURFACE> st = new LinkList <SURFACE>();
                    Node <SURFACE>     sn = lshadow.sl.Head;
                    while (sn != null)//将shap的线链反序
                    {
                        st.Head_Insert(sn.Data);
                        sn = sn.Next;
                    }
                    sn = st.Head;
                    while (sn != null)
                    {
                        lpa.sl.Head_Insert(sn.Data);
                        sn = sn.Next;
                    }
                    #endregion case2
                }
            }
            else
            {//如果标记点在父点的尾边上
                if (lshadow.sl.Head.Data.Belongme(ls_pk))
                {
                    info.Insert("case3");
                    #region case3
                    Node <SURFACE> sn = lshadow.sl.Head;
                    while (sn != null)
                    {
                        //用父点换掉边中的影子点
                        lpa.sl.Insert(sn.Data);
                        sn = sn.Next;
                    }
                    #endregion
                }
                else
                {
                    info.Insert("case4");
                    #region case4
                    LinkList <SURFACE> st = new LinkList <SURFACE>();
                    Node <SURFACE>     sn = lshadow.sl.Head;
                    while (sn != null)//将shap的线链反序
                    {
                        st.Head_Insert(sn.Data);
                        sn = sn.Next;
                    }
                    sn = st.Head;
                    while (sn != null)
                    {
                        lpa.sl.Insert(sn.Data);
                        sn = sn.Next;
                    }
                    #endregion
                }
            }
            lpa.p1.ll.Delete(lshadow);
            lpa.p2.ll.Delete(lshadow);
            sn_current = lpa.sl.Last;
        }
예제 #10
0
 public void Get_initialpl(LinkList <PO> pl0)
 {
     initial_pl = pl0;
 }
예제 #11
0
 public void GetPL(LinkList <PO> pl0)
 {
     pl = pl0;
 }
예제 #12
0
        private void shadowPO(PO shap, PO shapflag, PO pap, PO papflag)
        {
            /*
             * 将影子点的边转移到父点中去
             * shap是影子点,shapflag是影子点的标记点
             * pap是父点,papflag是父点的标记点
             */
            util u1 = new util();

            if (pap.ll.Head.Data.Po_insideme(papflag))
            {//如果标记点在父点的首边上
                if (shap.ll.Head.Data.Po_insideme(shapflag))
                {
                    #region case1
                    Node <LINE> lnt = shap.ll.Head;
                    while (lnt != null)
                    {
                        //用父点换掉边中的影子点
                        lnt.Data.Po_insideme_and_changeit(pap);
                        pap.ll.Head_Insert(lnt.Data);
                        lnt = lnt.Next;
                    }
                    #endregion case1
                }
                else
                {
                    #region case2
                    LinkList <LINE> lt  = new LinkList <LINE>();
                    Node <LINE>     lnt = shap.ll.Head;
                    while (lnt != null)//将shap的线链反序
                    {
                        lt.Head_Insert(lnt.Data);
                        lnt = lnt.Next;
                    }
                    lnt = lt.Head;
                    while (lnt != null)
                    {
                        lnt.Data.Po_insideme_and_changeit(pap);
                        pap.ll.Head_Insert(lnt.Data);
                        lnt = lnt.Next;
                    }
                    #endregion case2
                }
            }
            else
            {//如果标记点在父点的尾边上
                if (shap.ll.Head.Data.Po_insideme(shapflag))
                {
                    shap.ToString();
                    #region case3
                    Node <LINE> lnt = shap.ll.Head;
                    while (lnt != null)
                    {
                        lnt.Data.Po_insideme_and_changeit(pap);
                        pap.ll.Insert(lnt.Data);
                        lnt = lnt.Next;
                    }
                    #endregion case3
                }
                else
                {
                    #region case4
                    LinkList <LINE> lt  = new LinkList <LINE>();
                    Node <LINE>     lnt = shap.ll.Head;
                    while (lnt != null)//将shap的线链反序
                    {
                        lt.Head_Insert(lnt.Data);
                        lnt = lnt.Next;
                    }
                    lnt = lt.Head;
                    while (lnt != null)
                    {
                        lnt.Data.Po_insideme_and_changeit(pap);
                        pap.ll.Insert(lnt.Data);
                        lnt = lnt.Next;
                    }
                    #endregion case4
                }
            }
            work_pl.Delete(shap);
            //如果此时父节点的尾边封闭,则开启其尾边相应方向
            if (!pap.ll.Last.Data.negtive && !pap.ll.Last.Data.positive && pkey.key != 3)
            {
                Open_direction(pap.ll, pap);
            }
        }
예제 #13
0
 public well2d()
 {
     ge_p_l = new LinkList <PO>();
 }
예제 #14
0
 public void Set_initial_pl(LinkList <PO> pl)
 {
     initial_pl = pl;
 }
예제 #15
0
 public void Set_ge_pl(LinkList <PO> pl)
 {
     ge_p_l = pl;
 }
예제 #16
0
 public void Get_model_l(LinkList <model2d> ml)
 {
     model_l = ml;
 }