Exemplo n.º 1
0
        /// 找到0节点和节点编号的圈圈
        private static void Get_Rim(ref WEntity2D[] Rim_Curves, ref List <WPoint2D> Ps_Out, ref List <int> Ns_Out)
        {
            for (int i = 0; i < Rim_Curves.Length; i++)
            {
                if (((WCurve2D)Rim_Curves[i]).Meshed_Check == false)
                {
                    return;                                                    /////如果有线没有Mesh则返回-1
                }
            }
            int[] Sorts = Geos2D_Other.Sort_Curves(Rim_Curves);

            int Num;
            bool Tc;                   /////判断某条线是否首尾颠倒,true为颠倒,false为不颠倒
            ///////处理第一条线///////
            Num = 0;
            WCurve2D C         = (WCurve2D)Rim_Curves[Num];
            List <int> Ns      = new List <int>();
            List <WPoint2D> Ps = new List <WPoint2D>();
            for (int i = 1; i < C.Nodes.Count; i++)
            {
                Ps.Add(C.Nodes[i]);      /////将Curve的Node复制出来至Ps
                Ns.Add(C.Nodes_num[i]);
            }
            Ps_Out = Ps;
            Ns_Out = Ns;

            //////处理中间线//////////
            for (int i = 1; i <= Sorts.Length - 1; i++)
            {
                Num = (int)(Math.Floor((double)(Sorts[i] / 2)));
                if (Sorts[i] - 2 * Num == 0)
                {
                    Tc = false;
                }
                else
                {
                    Tc = true;         /////首尾颠倒则为true
                }
                Ps = new List <WPoint2D>();
                Ns = new List <int>();
                C  = (WCurve2D)Rim_Curves[Num];
                for (int j = 0; j < C.Nodes.Count; j++)
                {
                    Ps.Add(C.Nodes[j]); /////将Curve的Node复制出来至Ps
                    Ns.Add(C.Nodes_num[j]);
                }
                WMFuncs2D.Points_Reverse(ref Ps, Tc);                       /////翻转点集
                WMFuncs2D.Nums_Reverse(ref Ns, Tc);                         /////翻转点集
                Ps.RemoveAt(0);                                             /////去掉起点
                Ns.RemoveAt(0);                                             /////去掉起点

                for (int j = 0; j < Ps.Count; j++)
                {
                    Ps_Out.Add(Ps[j]);
                    Ns_Out.Add(Ns[j]);
                }
            }
        }
Exemplo n.º 2
0
        /// 返回值为新的自由节点数量,用于DoubleRim
        private static int Rim_Output(ref WEntity2D[] Rim_Curves, string Path, string Name, int N)
        {
            for (int i = 0; i < Rim_Curves.Length; i++)
            {
                if (((WCurve2D)Rim_Curves[i]).Meshed_Check == false)
                {
                    return(-1);                                                   /////如果有线没有Mesh则返回-1
                }
            }
            StreamWriter Sw = new System.IO.StreamWriter(Path + Name + ".rim");
            int[] Sorts     = Geos2D_Other.Sort_Curves(Rim_Curves);

            int Num;
            bool Tc;                   /////判断某条线是否首尾颠倒,true为颠倒,false为不颠倒
            WCurve2D C;
            List <WPoint2D> Ps;
            List <int> Ns = new List <int>();
            int QuanI     = N;
            ///////处理第一条线///////
            Num = 0;
            C   = (WCurve2D)Rim_Curves[Num];
            Ps  = new List <WPoint2D>();
            for (int i = 0; i < C.Nodes.Count; i++)
            {
                Ps.Add(C.Nodes[i]);                                     /////将Curve的Node复制出来至Ps
            }
            Ps.RemoveAt(0);                                             /////去掉起点,因为最后一条线包含该点
            N = WMFuncs2D.NsID_App(ref Ps, ref Ns, N);                  /////形成节点编号
            WMFuncs2D.Ns_Out(ref Ps, ref Ns, false, 0, ref Sw);

            //////处理中间线//////////
            for (int i = 1; i <= Sorts.Length - 1; i++)
            {
                Num = (int)(Math.Floor((double)(Sorts[i] / 2)));
                if (Sorts[i] - 2 * Num == 0)
                {
                    Tc = false;
                }
                else
                {
                    Tc = true;         /////首尾颠倒则为true
                }
                Ps = new List <WPoint2D>();
                C  = (WCurve2D)Rim_Curves[Num];
                for (int j = 0; j < C.Nodes.Count; j++)
                {
                    Ps.Add(C.Nodes[j]);                                     /////将Curve的Node复制出来至Ps
                }
                WMFuncs2D.Points_Reverse(ref Ps, Tc);                       /////翻转点集
                Ps.RemoveAt(0);                                             /////去掉起点

                N = WMFuncs2D.NsID_App(ref Ps, ref Ns, N);                  /////定义节点编号
                WMFuncs2D.Ns_Out(ref Ps, ref Ns, false, 0, ref Sw);         /////输出
            }
            Sw.Close();
            return(N - QuanI);
        }