public Form1() { InitializeComponent(); ProjectionBox.SelectedItem = ProjectionBox.Items[0]; CurrentDrawable = Models.Sphere(0.5, 20, 20); 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; }
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(); }