Ejemplo n.º 1
0
 public static void draw_line(d4 point1, d4 point2, PictureBox p, Graphics g)
 {
     point1.x = point1.X * E1[0] + point1.Y * E2[0] + point1.Z * E3[0] + point1.T * E4[0];
     point1.y = point1.X * E1[1] + point1.Y * E2[1] + point1.Z * E3[1] + point1.T * E4[1];
     point2.x = point2.X * E1[0] + point2.Y * E2[0] + point2.Z * E3[0] + point2.T * E4[0];
     point2.y = point2.X * E1[1] + point2.Y * E2[1] + point2.Z * E3[1] + point2.T * E4[1];
     g.DrawLine(Pens.White, (float)point1.x + p.Width / 2, (float)point1.y + p.Height / 2, (float)point2.x + p.Width / 2, (float)point2.y + p.Height / 2);
 }
Ejemplo n.º 2
0
        public static void draw_line_color(d4 point1, d4 point2, Color c, PictureBox p, Graphics g)
        {
            point1.x = point1.X * E1[0] + point1.Y * E2[0] + point1.Z * E3[0] + point1.T * E4[0];
            point1.y = point1.X * E1[1] + point1.Y * E2[1] + point1.Z * E3[1] + point1.T * E4[1];
            point2.x = point2.X * E1[0] + point2.Y * E2[0] + point2.Z * E3[0] + point2.T * E4[0];
            point2.y = point2.X * E1[1] + point2.Y * E2[1] + point2.Z * E3[1] + point2.T * E4[1];
            Pen pn = new Pen(c);

            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);
        }
Ejemplo n.º 3
0
        void draw_coordinate_axis()
        {
            d4 x, y, z, t, zero;

            x    = new d4(100, 0, 0, 0);
            y    = new d4(0, 100, 0, 0);
            z    = new d4(0, 0, 100, 0);
            t    = new d4(0, 0, 0, 100);
            zero = new d4(0, 0, 0, 0);

            d4.draw_line_color(zero, x, Color.Red, pictureBox1, g);
            d4.draw_line_color(zero, y, Color.Blue, pictureBox1, g);
            d4.draw_line_color(zero, z, Color.Green, pictureBox1, g);
            d4.draw_line_color(zero, t, Color.Yellow, pictureBox1, g);
        }
Ejemplo n.º 4
0
        private void Timer1_Tick(object sender, EventArgs e)
        {
            g.Clear(Color.Black);
            d4.reset();
            d4.rotate(trackBar1.Value, trackBar2.Value, trackBar3.Value, trackBar4.Value, trackBar5.Value, trackBar6.Value);
            d4 zero = new d4(0, 0, 0, 0);

            for (int i = 0; i < k; i++)
            {
                d4.draw_point(a[i], pictureBox1, g);
                //d4.draw_line(a[i], a[i+k/4], pictureBox1, g);
                //d4.draw_line(a[i+k/4], a[i + k / 2], pictureBox1, g);
                //d4.draw_line(a[i + k / 2], a[i + 3*k / 4], pictureBox1, g);
            }
            draw_coordinate_axis();
            pictureBox1.Image = b;
        }
Ejemplo n.º 5
0
        private void Form1_Load(object sender, EventArgs e)
        {
            d4.reset();//инизиализируем базис
            b = new Bitmap(pictureBox1.Width, pictureBox1.Height);
            g = Graphics.FromImage(b);
            a = new d4[k];
            //строим функцию
            int q = 0;

            for (int i = 0; i < k; i++)
            {
                a[i] = new d4(300 * Math.Sin(i * Math.PI / 180) * Math.Sin(i * Math.PI / 180) * Math.Sin(i * Math.PI / 180),
                              300 * Math.Cos(i * Math.PI / 180) * Math.Sin(i * Math.PI / 180) * Math.Sin(i * Math.PI / 180),
                              300 * Math.Cos(i * Math.PI / 180) * Math.Sin(i * Math.PI / 180),
                              300 * Math.Cos(i * Math.PI / 180));
            }
            pictureBox1.Image = b;
            timer1.Enabled    = true;
            timer1.Interval   = 1;
        }
Ejemplo n.º 6
0
 public static void draw_point(d4 point, PictureBox p, Graphics g)
 {
     point.x = point.X * E1[0] + point.Y * E2[0] + point.Z * E3[0] + point.T * E4[0];
     point.y = point.X * E1[1] + point.Y * E2[1] + point.Z * E3[1] + point.T * E4[1];
     g.FillEllipse(Brushes.White, (float)point.x + p.Width / 2, (float)point.y + p.Height / 2, 2, 2);
 }