Exemple #1
0
        public Form1()
        {
            InitializeComponent();
            current_primitive = new Icosahedron(1);
            Matrix projection = Transformations.PerspectiveProjection(-0.1, 0.1, -0.1, 0.1, 0.1, 20);

            camera = new Camera(new Vector(1, 1, 1), Math.PI / 4, -Math.PI / 4, projection);
            ProjectionComboBox.SelectedItem = ProjectionComboBox.Items[0];
            PrimitiveComboBox.SelectedItem  = PrimitiveComboBox.Items[0];
        }
Exemple #2
0
        private void Rotate()
        {
            double rotatingX = DegToRad((double)numericUpDown4.Value);
            double rotatingY = DegToRad((double)numericUpDown5.Value);
            double rotatingZ = DegToRad((double)numericUpDown6.Value);

            current_primitive.Apply(Transformations.RotateX(rotatingX)
                                    * Transformations.RotateY(rotatingY)
                                    * Transformations.RotateZ(rotatingZ));
            pictureBox1.Refresh();
        }
Exemple #3
0
 private void DrawSceneBtn_Click(object sender, EventArgs e)
 {
     without_colors    = false;
     moreThanOneObj    = true;
     current_primitive = new Icosahedron(1);
     current_primitive.Apply(Transformations.Translate(0, 0.20, -0.40));
     objects.Add(current_primitive);
     current_primitive = new Tetrahedron(1);
     current_primitive.Apply(Transformations.Translate(0, 0, 0.80));
     objects.Add(current_primitive);
     pictureBox1.Invalidate();
 }
Exemple #4
0
        private void ApplyPrimitive_Click(object sender, EventArgs e)
        {
            moreThanOneObj = false;
            without_colors = false;
            objects.Clear();
            switch (PrimitiveComboBox.SelectedItem.ToString())
            {
            case "Тетраэдр":
            {
                current_primitive = new Tetrahedron(1);
                break;
            }

            case "Икосаэдр":
            {
                current_primitive = new Icosahedron(1);
                break;
            }

            default:
            {
                current_primitive = new Tetrahedron(1);
                break;
            }
            }

            Matrix projection = Transformations.PerspectiveProjection(-0.1, 0.1, -0.1, 0.1, 0.1, 20);

            switch (ProjectionComboBox.SelectedItem.ToString())
            {
            case "Перспективная":
            {
                projection = Transformations.PerspectiveProjection(-0.1, 0.1, -0.1, 0.1, 0.1, 20);
                camera     = new Camera(new Vector(1, 1, 1), Math.PI / 4, -Math.PI / 4, projection);
                break;
            }

            case "Ортогональная XY":
            {
                camera = new Camera(new Vector(0, 0, 0), 0, 0, Transformations.RotateX(Math.PI / 2) * Transformations.OrthogonalProjection());
                break;
            }

            case "Ортогональная XZ":
            {
                camera = new Camera(new Vector(0, 0, 0), 0, 0, Transformations.OrthogonalProjection());
                break;
            }

            case "Ортогональная YZ":
            {
                camera = new Camera(new Vector(0, 0, 0), 0, 0, Transformations.RotateY(-Math.PI / 2) * Transformations.OrthogonalProjection());
                break;
            }

            default:
            {
                projection = Transformations.PerspectiveProjection(-0.1, 0.1, -0.1, 0.1, 0.1, 20);
                break;
            }
            }
            pictureBox1.Invalidate();
        }
        private void ApplyPrimitive_Click(object sender, EventArgs e)
        {
            sceneView1.without_colors = false;
            switch (PrimitiveComboBox.SelectedItem.ToString())
            {
            case "Тетраэдр":
            {
                Current_primitive = new Tetrahedron(1);
                break;
            }

            case "Икосаэдр":
            {
                Current_primitive = new Icosahedron(1);
                break;
            }

            case "График":
            {
                Current_primitive = new Plot();
                break;
            }

            default:
            {
                Current_primitive = new Tetrahedron(1);
                break;
            }
            }

            Matrix projection = Transformations.PerspectiveProjection(-0.1, 0.1, -0.1, 0.1, 0.1, 20);

            switch (ProjectionComboBox.SelectedItem.ToString())
            {
            case "Перспективная":
            {
                projection            = Transformations.PerspectiveProjection(-0.1, 0.1, -0.1, 0.1, 0.1, 20);
                camera                = new Camera(new Vector(1, 1, 1), Math.PI / 4, -Math.PI / 4, projection);
                sceneView1.ViewCamera = camera;

                break;
            }

            case "Ортогональная XY":
            {
                sceneView1.ViewCamera = new Camera(new Vector(0, 0, 0), 0, 0, Transformations.RotateX(Math.PI / 2) * Transformations.OrthogonalProjection());
                break;
            }

            case "Ортогональная XZ":
            {
                sceneView1.ViewCamera = new Camera(new Vector(0, 0, 0), 0, 0, Transformations.OrthogonalProjection());
                break;
            }

            case "Ортогональная YZ":
            {
                sceneView1.ViewCamera = new Camera(new Vector(0, 0, 0), 0, 0, Transformations.RotateY(-Math.PI / 2) * Transformations.OrthogonalProjection());
                break;
            }

            default:
            {
                projection = Transformations.PerspectiveProjection(-0.1, 0.1, -0.1, 0.1, 0.1, 20);
                break;
            }
            }
            sceneView1.Refresh();
        }