Exemple #1
0
        //DRAW FIGURE
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (comboBox1.SelectedIndex)
            {
            case 0:
                //Tetrahedron
                g.Clear(Color.White);
                figure = new Polyhedron();
                figure.Tetrahedron();
                figure.Show(g, projection);
                break;

            case 1:
                //Hexahedron
                g.Clear(Color.White);
                figure = new Polyhedron();
                figure.Hexahedron();
                figure.Show(g, projection);
                break;

            case 2:
                //Oktahedron
                g.Clear(Color.White);
                figure = new Polyhedron();
                figure.Octahedron();
                figure.Show(g, projection);
                break;

            case 3:
                //Icosahedron
                g.Clear(Color.White);
                figure = new Polyhedron();
                figure.Icosahedron();
                figure.Show(g, projection);
                break;

            case 4:
                //Dodecahedron
                g.Clear(Color.White);
                figure = new Polyhedron();
                figure.Dodecahedron();
                figure.Show(g, projection);
                break;

            default:
                break;
            }
        }
Exemple #2
0
        //Рисование фигуры
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (comboBox1.SelectedIndex)
            {
            case 0:
                //Татраэдр
                g.Clear(Color.White);
                figure = new Polyhedron();
                figure.Tetrahedron();
                if (clipping == 0)
                {
                    figure.Show(g, projection);
                }
                else if (clipping == Clipping.ZBuffer)
                {
                    show_z_buff();
                }
                break;

            case 1:
                //Гексаэдр
                g.Clear(Color.White);
                figure = new Polyhedron();
                figure.Hexahedron();
                if (clipping == 0)
                {
                    figure.Show(g, projection);
                }
                else if (clipping == Clipping.ZBuffer)
                {
                    show_z_buff();
                }
                break;

            case 2:
                //Октаэдр
                g.Clear(Color.White);
                figure = new Polyhedron();
                figure.Octahedron();
                if (clipping == 0)
                {
                    figure.Show(g, projection);
                }
                else if (clipping == Clipping.ZBuffer)
                {
                    show_z_buff();
                }
                break;

            case 3:
                //Икосаэдр
                g.Clear(Color.White);
                figure = new Polyhedron();
                figure.Icosahedron();
                if (clipping == 0)
                {
                    figure.Show(g, projection);
                }
                else if (clipping == Clipping.ZBuffer)
                {
                    show_z_buff();
                }
                break;

            case 4:
                //Додекаэдр
                g.Clear(Color.White);
                figure = new Polyhedron();
                figure.Dodecahedron();
                if (clipping == 0)
                {
                    figure.Show(g, projection);
                }
                else if (clipping == Clipping.ZBuffer)
                {
                    show_z_buff();
                }
                break;

            default:
                break;
            }
        }
Exemple #3
0
        //DRAW FIGURE
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (comboBox1.SelectedIndex)
            {
            case 0:
                //Tetrahedron
                g.Clear(Color.White);
                figure = new Polyhedron();
                figure.Tetrahedron();
                if (clipping == 0)
                {
                    figure.Show(g, projection);
                }
                else if (clipping == Clipping.Gouraud)
                {
                    show_gouraud();
                }
                else if (clipping == Clipping.ZBuffer)
                {
                    show_z_buff();
                }
                else if (clipping == Clipping.Texture)
                {
                    show_texture();
                }
                break;

            case 1:
                //Hexahedron
                g.Clear(Color.White);
                figure = new Polyhedron();
                figure.Hexahedron();
                if (clipping == 0)
                {
                    figure.Show(g, projection);
                }
                else if (clipping == Clipping.Gouraud)
                {
                    show_gouraud();
                }
                else if (clipping == Clipping.ZBuffer)
                {
                    show_z_buff();
                }
                else if (clipping == Clipping.Texture)
                {
                    show_texture();
                }
                break;

            case 2:
                //Oktahedron
                g.Clear(Color.White);
                figure = new Polyhedron();
                figure.Octahedron();
                if (clipping == 0)
                {
                    figure.Show(g, projection);
                }
                else if (clipping == Clipping.Gouraud)
                {
                    show_gouraud();
                }
                else if (clipping == Clipping.ZBuffer)
                {
                    show_z_buff();
                }
                else if (clipping == Clipping.Texture)
                {
                    show_texture();
                }
                break;

            case 3:
                //Icosahedron
                g.Clear(Color.White);
                figure = new Polyhedron();
                figure.Icosahedron();
                if (clipping == 0)
                {
                    figure.Show(g, projection);
                }
                else if (clipping == Clipping.Gouraud)
                {
                    show_gouraud();
                }
                else if (clipping == Clipping.ZBuffer)
                {
                    show_z_buff();
                }
                else if (clipping == Clipping.Texture)
                {
                    show_texture();
                }
                break;

            case 4:
                //Dodecahedron
                g.Clear(Color.White);
                figure = new Polyhedron();
                figure.Dodecahedron();
                if (clipping == 0)
                {
                    figure.Show(g, projection);
                }
                else if (clipping == Clipping.Gouraud)
                {
                    show_gouraud();
                }
                else if (clipping == Clipping.ZBuffer)
                {
                    show_z_buff();
                }
                else if (clipping == Clipping.Texture)
                {
                    show_texture();
                }
                break;

            default:
                break;
            }
        }
Exemple #4
0
        public void Dodecahedron()
        {
            Polygons = new List <Polygon>();
            Polyhedron ik = new Polyhedron();

            ik.Icosahedron();

            List <Point3D> pts = new List <Point3D>();

            foreach (Polygon f in ik.Polygons)
            {
                pts.Add(f.Center);
            }

            Polygons.Add(new Polygon(new List <Point3D>
            {
                new Point3D(pts[0]),
                new Point3D(pts[1]),
                new Point3D(pts[2]),
                new Point3D(pts[3]),
                new Point3D(pts[4])
            }));

            Polygons.Add(new Polygon(new List <Point3D>
            {
                new Point3D(pts[5]),
                new Point3D(pts[6]),
                new Point3D(pts[7]),
                new Point3D(pts[8]),
                new Point3D(pts[9])
            }));

            for (int i = 0; i < 5; ++i)
            {
                Polygons.Add(new Polygon(new List <Point3D>
                {
                    new Point3D(pts[i]),
                    new Point3D(pts[(i + 1) % 5]),
                    new Point3D(pts[(i == 4) ? 10 : 2 * i + 12]),
                    new Point3D(pts[(i == 4) ? 11 : 2 * i + 13]),
                    new Point3D(pts[2 * i + 10])
                }));
            }

            Polygons.Add(new Polygon(new List <Point3D>
            {
                new Point3D(pts[5]),
                new Point3D(pts[6]),
                new Point3D(pts[13]),
                new Point3D(pts[10]),
                new Point3D(pts[11])
            }));
            Polygons.Add(new Polygon(new List <Point3D>
            {
                new Point3D(pts[6]),
                new Point3D(pts[7]),
                new Point3D(pts[15]),
                new Point3D(pts[12]),
                new Point3D(pts[13])
            }));
            Polygons.Add(new Polygon(new List <Point3D>
            {
                new Point3D(pts[7]),
                new Point3D(pts[8]),
                new Point3D(pts[17]),
                new Point3D(pts[14]),
                new Point3D(pts[15])
            }));
            Polygons.Add(new Polygon(new List <Point3D>
            {
                new Point3D(pts[8]),
                new Point3D(pts[9]),
                new Point3D(pts[19]),
                new Point3D(pts[16]),
                new Point3D(pts[17])
            }));
            Polygons.Add(new Polygon(new List <Point3D>
            {
                new Point3D(pts[9]),
                new Point3D(pts[5]),
                new Point3D(pts[11]),
                new Point3D(pts[18]),
                new Point3D(pts[19])
            }));

            UpdateCenter();
        }