コード例 #1
0
        private void Rotate()
        {
            double rotatingX = DegreesToRadians((double)numericUpDown4.Value);
            double rotatingY = DegreesToRadians((double)numericUpDown5.Value);
            double rotatingZ = DegreesToRadians((double)numericUpDown6.Value);

            CurrentDrawable.Apply(Transformations.RotateX(rotatingX)
                                  * Transformations.RotateY(rotatingY)
                                  * Transformations.RotateZ(rotatingZ));
            sceneView1.Refresh();
        }
コード例 #2
0
        private void ApplyProjection_Click(object sender, EventArgs e)
        {
            switch (ProjectionBox.SelectedItem.ToString())
            {
            case ("Перспективная"):
            {
                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.Atan(1 / Math.Sqrt(3)), projection);
                sceneView1.Camera = camera;
                break;
            }

            case ("Ортографическая XY"):
            {
                camera            = new Camera(new Vector(0, 0, 0), 0, 0, Transformations.OrthogonalProjection());
                sceneView1.Camera = camera;
                break;
            }

            case ("Ортографическая XZ"):
            {
                camera            = new Camera(new Vector(0, 0, 0), 0, 0, Transformations.RotateX(Math.PI / 2) * Transformations.OrthogonalProjection());
                sceneView1.Camera = camera;
                break;
            }

            case ("Ортографическая YZ"):
            {
                camera            = new Camera(new Vector(0, 0, 0), 0, 0, Transformations.RotateY(-Math.PI / 2) * Transformations.OrthogonalProjection());
                sceneView1.Camera = camera;
                break;
            }

            default:
            {
                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.Atan(1 / Math.Sqrt(3)), projection);
                sceneView1.Camera = camera;
                break;
            }
            }
            sceneView1.Refresh();
        }