Esempio n. 1
0
        /// <summary>
        /// Vẽ đường thẳng nối liền giữa 2 điểm A và B
        /// </summary>
        /// <param name="n">1: Vẽ nét liền 2: Vẽ nét đứt</param>
        public void DrawLine(Graphics g, int A, int B, int n = 1)
        {
            Point point1 = ToaDo.NguoiDungMayTinh_3D(this.Dinh[A, 0], this.Dinh[A, 1], this.Dinh[A, 2]),
                  point2 = ToaDo.NguoiDungMayTinh_3D(this.Dinh[B, 0], this.Dinh[B, 1], this.Dinh[B, 2]);


            if (n == 2)
            {
                new Line(point1, point2, Color.RoyalBlue).NetDut(g);
            }
            else
            {
                new Line(point1, point2, Color.Navy).Draw(g);
            }


            Point point;

            for (int i = 0; i < 8; i++)
            {
                point = ToaDo.NguoiDungMayTinh_3D(this.Dinh[i, 0], this.Dinh[i, 1], this.Dinh[i, 2]);
                ToaDo.HienThi(point, g, Color.Pink);
                char c = (char)(65 + i);
                g.DrawString(c.ToString(), new Font("Arial", 14), Brushes.Red, point);
            }
        }
Esempio n. 2
0
        public void DrawElip(Graphics g)
        {
            // Tính bán kính nhỏ của elip
            Point point = ToaDo.NguoiDungMayTinh_3D(this.TamDay[2, 0], this.TamDay[2, 1], this.TamDay[2, 2]);

            point = ToaDo.MayTinhNguoiDung_3D(point);

            double   d        = this.BanKinhDay * (Math.Sqrt(2) / 2);
            int      b        = (int)d;// this.BanKinhDay / 3 ;// (int)Math.Sqrt(Math.Abs(Math.Pow(this.BanKinhDay, 2) * Math.Pow(point.Y, 2)/(Math.Pow(this.BanKinhDay,2)-Math.Pow(point.X,2))));
            hinhelip hinhElip = new hinhelip(ToaDo.NguoiDungMayTinh_3D(this.TamDay[1, 0], this.TamDay[1, 1], this.TamDay[1, 2]), this.BanKinhDay * 5, b * 5, Color.Black);

            hinhElip.venetdut_elip(g);

            // Vẽ các hình elip
            hinhElip = new hinhelip(ToaDo.NguoiDungMayTinh_3D(this.TamDay[4, 0], this.TamDay[4, 1], this.TamDay[4, 2]), this.BanKinhDay * 5, b * 5, Color.Black);
            hinhElip.veelip(g);

            dthang line = new dthang(ToaDo.NguoiDungMayTinh_3D(this.TamDay[1, 0], this.TamDay[1, 1], this.TamDay[1, 2]),
                                     ToaDo.NguoiDungMayTinh_3D(this.TamDay[2, 0], this.TamDay[2, 1], this.TamDay[2, 2]),
                                     Color.Black);

            line.venetdut(g);

            line = new dthang(ToaDo.NguoiDungMayTinh_3D(this.TamDay[1, 0], this.TamDay[1, 1], this.TamDay[1, 2]),
                              ToaDo.NguoiDungMayTinh_3D(this.TamDay[4, 0], this.TamDay[4, 1], this.TamDay[4, 2]),
                              Color.Black);
            line.venetdut(g);

            line = new dthang(ToaDo.NguoiDungMayTinh_3D(this.TamDay[4, 0], this.TamDay[4, 1], this.TamDay[4, 2]),
                              ToaDo.NguoiDungMayTinh_3D(this.TamDay[5, 0], this.TamDay[5, 1], this.TamDay[5, 2]),
                              Color.Black);
            line.vedthang(g);
        }
Esempio n. 3
0
        public void Draw(Graphics g)
        {
            // Vẽ nét đứt
            DrawLine(g, 0, 1, 2);
            DrawLine(g, 3, 0, 2);
            DrawLine(g, 0, 4, 2);
            // Vẽ nét liền
            DrawLine(g, 1, 2);
            DrawLine(g, 2, 3);
            DrawLine(g, 4, 5);
            DrawLine(g, 5, 6);
            DrawLine(g, 6, 7);
            DrawLine(g, 7, 4);
            DrawLine(g, 1, 5);
            DrawLine(g, 2, 6);
            DrawLine(g, 3, 7);

            Point point;

            for (int i = 0; i < 8; i++)
            {
                point = ToaDo.NguoiDungMayTinh_3D(this.Dinh[i, 0], this.Dinh[i, 1], this.Dinh[i, 2]);
                ToaDo.HienThi(point, g, Color.White);
                char c = (char)(65 + i);
                g.DrawString(c.ToString(), new Font("Arial", 14), Brushes.Red, point);
            }
        }
        /// <summary>
        /// Vẽ đường thẳng nối liền giữa 2 điểm A và B
        /// </summary>
        /// <param name="n">1: Vẽ nét liền 2: Vẽ nét đứt</param>
        public void DrawLine(Graphics g, int A, int B, int n = 1)
        {
            Point point1 = ToaDo.NguoiDungMayTinh_3D(this.Dinh[A, 0], this.Dinh[A, 1], this.Dinh[A, 2]),
                  point2 = ToaDo.NguoiDungMayTinh_3D(this.Dinh[B, 0], this.Dinh[B, 1], this.Dinh[B, 2]);

            //ToaDo.HienThi(point1, g);
            //ToaDo.HienThi(point2, g);
            Line line = new Line(point1, point2, Color.Black);

            if (n == 2)
            {
                line.NetDut(g);
            }
            else
            {
                line.Draw(g);
            }

            Point point;

            for (int i = 0; i < 8; i++)
            {
                point = ToaDo.NguoiDungMayTinh_3D(this.Dinh[i, 0], this.Dinh[i, 1], this.Dinh[i, 2]);
                ToaDo.HienThi(point, g, Color.Pink);
                char c = (char)(65 + i);
                g.DrawString(c.ToString(), new Font("Verdana", 14), Brushes.Pink, point);
            }
        }
Esempio n. 5
0
        public void Draw(Graphics g)
        {
            DrawLine(g, 1, 2, 2);
            DrawLine(g, 1, 4, 2);

            Point point = ToaDo.NguoiDungMayTinh_3D(this.TamDay[1, 0], this.TamDay[1, 1], this.TamDay[1, 2]);

            new HinhTron(point, BanKinhDay).Draw_W_Color_Line(g, Color.Navy);

            //O
            ToaDo.HienThi(point, g, Color.Red);
            char c = 'O';

            g.DrawString(c.ToString(), new Font("Arial", 14), Brushes.Red, point);

            point = ToaDo.NguoiDungMayTinh_3D(this.TamDay[1, 0], this.TamDay[1, 1], this.TamDay[1, 2]);
            double d = this.BanKinhDay * (Math.Sqrt(2) / 2);
            int    b = (int)d;

            new HinhElip(point, this.BanKinhDay, b / 2, Color.Navy).NetDut(g);



            //new HinhElip(point, b / 2, this.BanKinhDay, Color.Blue).NetDut(g);
            //new HinhElip(point, b / 2, this.BanKinhDay, Color.Blue).NetDut(g);



            /*
             * Point point = ToaDo.NguoiDungMayTinh_3D(this.TamDay[1, 0], this.TamDay[1, 1], this.TamDay[1, 2]);
             * ToaDo.HienThi(point, g, Color.Red);
             *
             *  point = ToaDo.NguoiDungMayTinh_3D(this.TamDay[4, 0], this.TamDay[4, 1], this.TamDay[4, 2]);
             * ToaDo.HienThi(point, g, Color.Red);
             *
             *
             *
             *
             * DrawElip(g);
             *
             * for (int i = 0; i < 6; i++)
             * {
             *  point = ToaDo.NguoiDungMayTinh_3D(this.TamDay[i, 0], this.TamDay[i, 1], this.TamDay[i, 2]);
             *  ToaDo.HienThi(point, g, Color.White);
             *  char c = (char)(65 + i);
             *  g.DrawString(c.ToString(), new Font("Verdana", 14), Brushes.Blue, point);
             * }
             *
             */
        }
Esempio n. 6
0
        public void DrawLine(Graphics g, int A, int B, int n = 1)
        {
            Point point1 = ToaDo.NguoiDungMayTinh_3D(this.TamDay[A, 0], this.TamDay[A, 1], this.TamDay[A, 2]),
                  point2 = ToaDo.NguoiDungMayTinh_3D(this.TamDay[B, 0], this.TamDay[B, 1], this.TamDay[B, 2]);


            Line line = new Line(point1, point2, Color.RoyalBlue);

            if (n == 2)
            {
                line.NetDut(g);
            }
            else
            {
                line.Draw(g);
            }
        }
Esempio n. 7
0
        public void DrawLine(Graphics g, int A, int B, int n = 1)
        {
            Point point1 = ToaDo.NguoiDungMayTinh_3D(this.TamDay[A, 0], this.TamDay[A, 1], this.TamDay[A, 2]),
                  point2 = ToaDo.NguoiDungMayTinh_3D(this.TamDay[B, 0], this.TamDay[B, 1], this.TamDay[B, 2]);

            //ToaDo.HienThi(point1, g);
            //ToaDo.HienThi(point2, g);
            dthang line = new dthang(point1, point2, Color.Black);

            if (n == 2)
            {
                line.venetdut(g);
            }
            else
            {
                line.vedthang(g);
            }
        }
Esempio n. 8
0
        public void VeHinhTru(Graphics g)
        {
            DrawLine(g, 0, 3);
            DrawLine(g, 2, 5);

            Point point = ToaDo.NguoiDungMayTinh_3D(this.TamDay[1, 0], this.TamDay[1, 1], this.TamDay[1, 2]);

            ToaDo.putpixel(point, g, Color.Black);
            point = ToaDo.NguoiDungMayTinh_3D(this.TamDay[4, 0], this.TamDay[4, 1], this.TamDay[4, 2]);
            ToaDo.putpixel(point, g, Color.Black);

            DrawElip(g);

            for (int i = 0; i < 6; i++)
            {
                point = ToaDo.NguoiDungMayTinh_3D(this.TamDay[i, 0], this.TamDay[i, 1], this.TamDay[i, 2]);
                ToaDo.putpixel(point, g, Color.Red);
                char c = (char)(65 + i);
                g.DrawString(c.ToString(), new Font("Verdana", 14), Brushes.Red, point);
            }
        }