示例#1
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();
        }
示例#2
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();
        }
示例#3
0
        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();
        }