Пример #1
0
        private void polygons3ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            iterator = 0;
            st.n = 8;
            polygons = new Polygon[st.n];

            Points = new List<double[]>[st.n];
            CopyPoints = new List<double[]>[st.n];
            p = new List<double[]>();
            for (int i = 0; i < st.n; i++)
            {
                if (i < 4)
                {
                    Points[i] = new List<double[]>();
                    CopyPoints[i] = new List<double[]>();
                    Read(ref Points[i], ref CopyPoints[i], ref p, "Polygon" + (i + 1) + "b.txt");

                    polygons[i] = new Polygon(Points[i], CopyPoints[i], i, p[i]);
                }
                else
                {
                    Points[i] = new List<double[]>();
                    CopyPoints[i] = new List<double[]>();
                    Read(ref Points[i], ref CopyPoints[i], ref p, "Polygon" + (i -3) + "b.txt");

                    polygons[i] = new Polygon(Points[i], CopyPoints[i], i, p[i]);
                }
            }
            grad = new GradientProjectionMethod(polygons, st, DrawPanel.Height, DrawPanel.Width);
            InitialEstimate ie = new InitialEstimate(polygons, DrawPanel.Height, DrawPanel.Width);
        }
Пример #2
0
        private void polygons1ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            iterator = 0;
            st.n = 20;
            polygons = new Polygon[st.n];

            Points = new List<double[]>[st.n];
            CopyPoints = new List<double[]>[st.n];
            p = new List<double[]>();
            for (int i = 0; i < st.n; i++)
            {
                //if (i < st.n)
                //{
                Points[i] = new List<double[]>();
                CopyPoints[i] = new List<double[]>();
                Read(ref Points[i], ref CopyPoints[i], ref p, "Polygon" + (i + 1) + ".txt");

                polygons[i] = new Polygon(Points[i], CopyPoints[i], i, p[i]);
                //}
                // else if((i>st.n-1)&&(i<2*st.n))
                // {
                //     Points[i] = new List<double[]>();
                //     CopyPoints[i] = new List<double[]>();
                //     Read(ref Points[i], ref CopyPoints[i], ref p, "Polygon" + (i - 19) + ".txt");

                //     polygons[i] = new Polygon(Points[i], CopyPoints[i], i, p[i]);

                // }
                //else
                //{
                //    Points[i] = new List<double[]>();
                //    CopyPoints[i] = new List<double[]>();
                //    Read(ref Points[i], ref CopyPoints[i], ref p, "Polygon" + (i - 39) + ".txt");

                //    polygons[i] = new Polygon(Points[i], CopyPoints[i], i, p[i]);

                //}
            }
            grad = new GradientProjectionMethod(polygons, st, DrawPanel.Height, DrawPanel.Width);
            InitialEstimate ie = new InitialEstimate(polygons, DrawPanel.Height, DrawPanel.Width);
        }