Esempio n. 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            var givenpoint2 = new List<Node>();
            var givenpoint3 = new List<Node>();

            Random rnd = new Random();
            for (int i = 0; i < 10; ++i)
            {
                givenpoint3.Add(new Node(0, false, rnd.NextDouble() * 1, rnd.NextDouble() * 1, rnd.NextDouble() * 1));
            }

            for (int i = 0; i < 2; ++i)
            {
                for (int j = 0; j < 2; ++j)
                {
                    for (int k = 0; k < 2; ++k)
                    {
                        givenpoint2.Add(new Node(0, false, i * 0.1, j * 0.1, k * 0.1));
                    }
                }
            }

            Invalidate();

            mesh = new Delaunay3d(givenpoint2);
            mesh.GetNormalizedMesh(out result);
            mesh.PrintXML();

            timer1.Interval = 10;
            timer2.Interval = 100;
            timer2.Start();
        }
Esempio n. 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            timer = new System.Timers.Timer();
            timer.Enabled = true;
            timer.AutoReset = true;
            timer.Interval = 100;
            timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);

            int r_div = (int)(diam / 2 / unitl);
            int theta_div;
            int length_div = (int)(length / unitl);

            for (int k = 0; k <= length_div; k++)
            {
                double z = length * k / length_div;
                givenpoint.Add(new Node(-256, false, 0.0, 0.0, z));
                for (int i = 1; i <= r_div; i++)
                {
                    double r = diam / 2 * i / r_div;
                    theta_div = (int)(r * 2 * Math.PI / unitl);
                    for (int j = 0; j < theta_div; j++)
                    {
                        double theta = 2 * Math.PI * j / theta_div;
                        givenpoint.Add(new Node(-256, false, r * Math.Cos(theta), r * Math.Sin(theta), z));
                    }
                }
            }
            Invalidate();

            mesh = new Delaunay3d(givenpoint);
            //	mesh.NextStep();
            //	mesh.NextStep();
            mesh.GetRawMesh(out result);
            //	timer1.Interval = 10;
        }