Example #1
0
        public static void draw(d3 point, PictureBox p, Graphics g, Color col)
        {//отображение точки на пикчерБоксе
            Brushes br;

            point.x = point.X * E1.C[0] + point.Y * E1.C[1] + point.Z * E1.C[2];
            point.y = point.X * E2.C[0] + point.Y * E2.C[1] + point.Z * E2.C[2];
            g.FillEllipse(Brushes.White, (float)point.x + p.Width / 2, -(float)point.y + p.Height / 2, 2, 2);
        }
Example #2
0
        public static void draw_line(d3 point1, d3 point2, PictureBox p, Graphics g, Color col)
        {//отображение прямой на пикчерБоксе
            point1.x = point1.X * E1.C[0] + point1.Y * E1.C[1] + point1.Z * E1.C[2];
            point1.y = point1.X * E2.C[0] + point1.Y * E2.C[1] + point1.Z * E2.C[2];
            point2.x = point2.X * E1.C[0] + point2.Y * E1.C[1] + point2.Z * E1.C[2];
            point2.y = point2.X * E2.C[0] + point2.Y * E2.C[1] + point2.Z * E2.C[2];
            Pen pn = new Pen(col);

            g.DrawLine(pn, (float)point1.x + p.Width / 2, -(float)point1.y + p.Height / 2, (float)point2.x + p.Width / 2, -(float)point2.y + p.Height / 2);
        }
Example #3
0
        /*
         * if ((((y1 <= y) && (y < y2)) || ((y2 <= y) && (y < y1))) && (((y2 - y1) != 0) && (x > (((x2 - x1) * (y - y1)) / (y2 - y1) + x1))))
         *     k++;
         */
        private void Form1_Load(object sender, EventArgs e)
        {
            d3.reset();
            bp1        = new Bitmap(pictureBox1.Width, pictureBox1.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            g1         = Graphics.FromImage(bp1); //комбо всех картинок на pictBox1
            bp2        = new Bitmap(pictureBox2.Width, pictureBox2.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            g2         = Graphics.FromImage(bp2); //комбо всех картинок на pictBox2
            bp3        = new Bitmap(pictureBox3.Width, pictureBox3.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            g3         = Graphics.FromImage(bp3); //комбо всех картинок на pictBox3
            b_pattern  = new Bitmap(pictureBox1.Width, pictureBox1.Height);
            b_vectors  = new Bitmap(pictureBox1.Width, pictureBox1.Height);
            b_settings = new Bitmap(pictureBox2.Width, pictureBox2.Height);
            b_s1       = new Bitmap(pictureBox3.Width, pictureBox3.Height);
            b_s2       = new Bitmap(pictureBox3.Width, pictureBox3.Height);
            b_s3       = new Bitmap(pictureBox3.Width, pictureBox3.Height);
            g_strt     = CreateGraphics();
            g_strt     = Graphics.FromImage(b_s1); //кнопка старта
            g_set      = CreateGraphics();
            g_set      = Graphics.FromImage(b_s2); //кнопка настроек
            g_vec      = CreateGraphics();
            g_vec      = Graphics.FromImage(b_s3); //кнопка списка векторов
            g_s        = CreateGraphics();         //еще неизвестный эл.
            g_s        = Graphics.FromImage(b_settings);
            g_v        = CreateGraphics();         //тут хранится отображение векторов
            g_v        = Graphics.FromImage(b_vectors);
            g_p        = CreateGraphics();         //здесь - узор, нарисованый векторами
            g_p        = Graphics.FromImage(b_pattern);
            //--------------------обработка pictureBox1
            //рисуем узор
            g_v.Clear(Color.Transparent);
            g_p.Clear(Color.Transparent);
            g_v.DrawLine(Pens.White, 0, 0, pictureBox1.Width, pictureBox1.Height);
            g_p.DrawLine(Pens.Blue, 0, 100, pictureBox1.Width, pictureBox1.Height);
            g1.CompositingMode = CompositingMode.SourceOver;
            g1.DrawImage(b_vectors, 0, 0);
            g1.DrawImage(b_pattern, 0, 0);
            pictureBox1.Image = bp1;
            //--------------------обработка pictureBox2
            //рисуем настройки:
            g_s.Clear(Color.Transparent);

            pictureBox2.Image = b_settings;
            //--------------------обработка pictureBox3
            //рисуем кнопки:
            b    = new string[3];
            b[0] = "Start";
            b[1] = "Vectors";
            b[2] = "Settings";
            g_strt.Clear(Color.Transparent);
            g_set.Clear(Color.Transparent);
            g_vec.Clear(Color.Transparent);
            Font f = new Font(FontFamily.GenericSansSerif, 10.0F, FontStyle.Bold);

            g_strt.DrawString(b[0], f, Brushes.White, 5, 20);
            g_set.DrawString(b[1], f, Brushes.White, (pictureBox3.Width / 3) + 5, 20);
            g_vec.DrawString(b[2], f, Brushes.White, (pictureBox3.Width * 2 / 3) + 5, 20);
            g3.CompositingMode = CompositingMode.SourceOver;
            g3.DrawImage(b_s1, 0, 0);
            g3.DrawImage(b_s2, 0, 0);
            g3.DrawImage(b_s3, 0, 0);
            pictureBox3.Image = bp3;

            //

            a = new d3(0, 0, 0);
            c = new d3(100, 0, 0);
            q = new d3(0, 100, 0);
            w = new d3(0, 0, 100);
            Random r = new Random();

            k = new d3[500];
            for (int i = 0; i < 500; i++)
            {
                k[i] = new d3(r.Next(-200, 200), r.Next(-200, 200), r.Next(-200, 200));
            }
        }