Ejemplo n.º 1
0
        private void button6_Click(object sender, EventArgs e)
        {
            Cam cam = CreateCam();

            for (int i = 0; i < 30; i++)
            {
                // видовая матрица
                g.Clear(Color.White);

                double angle = 10 * i * Math.PI / 180;
                if (angle >= 2 * Math.PI)
                {
                    angle -= 2 * Math.PI;
                }

                Polyhedron ph_copy = ph.Clone() as Polyhedron;
                //Affine.MakePerspectiveProjection(ph_copy, 45 * Math.PI / 180, 100, 5);
                Affine.MakeView(ph_copy, cam);
                Affine.RotateOverCenter(ph_copy, 'z', -angle);
                // вывести
                Affine.CentralProjection(ph_copy, 10);
                //Affine.IsometricProjection(ph_copy);
                ph_copy.Draw(g, Color.Black);
                //pictureBox1.Invalidate();
                System.Threading.Thread.Sleep(100);
            }
        }
Ejemplo n.º 2
0
        private void Plot()
        {
            if (ph == null)
            {
                return;
            }
            g.Clear(Color.White);

            Point3d.DrawPoint0(g, Color.LimeGreen);

            Polyhedron proj = ph.Clone() as Polyhedron;

            if (radioButtonCenterProj.Checked)
            {
                Affine.CentralProjection(proj, 10);
                pictureBox2.Image = bmp[3];
            }
            else if (radioButtonIsoProj.Checked)
            {
                Affine.IsometricProjection(proj);
                pictureBox2.Image = bmp[0];
            }
            else if (radioButtonOrtoProj.Checked)
            {
                switch (comboBoxProjPlane.SelectedIndex)
                {
                case 0:
                    Affine.OrtographicProjection(proj, 'z');
                    pictureBox2.Image = bmp[1];
                    break;

                case 1:
                    Affine.OrtographicProjection(proj, 'y');
                    pictureBox2.Image = bmp[2];
                    break;

                case 2:
                    Affine.OrtographicProjection(proj, 'x');
                    pictureBox2.Image = bmp[3];
                    break;

                default:
                    throw new Exception("Bad projection plane.");
                }
            }
            else
            {
                throw new Exception("Projection error.");
            }

            proj.Draw(g, Color.Black);
            //pictureBox1.Invalidate();
        }
Ejemplo n.º 3
0
        //Действия
        private void Draw()
        {
            if (polyhedron == null)
            {
                return;
            }
            g.Clear(Color.White);

            My_Point.DrawPoint0(g, Color.LimeGreen);

            Polyhedron proj = polyhedron.Clone() as Polyhedron;

            AffineTransform.IsometricProjection(proj);

            proj.Draw(g, Color.Black);
        }