VectorVisualizer Version 1.2
by Kevin Seib and Pascal Glaeser
Loading...
Searching...
No Matches
PlotForm3D.cs
Go to the documentation of this file.
1using System;
2using System.Windows.Forms;
3using System.Windows.Forms.Integration;
5
7{
8 public partial class PlotForm3D : Form
9 {
10 public PlotForm3D(
11 Func<double, double, double, double> scalarField3D,
12 double zFixed,
13 int resolution = 80,
14 string? gradientText = null)
15 {
16 InitializeComponent();
17
18 Text = "3D-Skalarfeld (Ebene z=f)";
19 Size = new System.Drawing.Size(800, 600);
20
21 // Host für WPF-View
22 var host = new ElementHost { Dock = DockStyle.Fill };
24 host.Child = View3D;
25
26 if (!string.IsNullOrWhiteSpace(gradientText))
27 {
28 // Linkes Panel mit Gradiententext
29 var infoPanel = new Panel();
30 infoPanel.Width = 200;
31 infoPanel.Dock = DockStyle.Fill;
32 infoPanel.BackColor = System.Drawing.Color.FromArgb(33, 33, 33);
33
34 var label = new System.Windows.Forms.Label();
35 label.Text = gradientText;
36 label.ForeColor = System.Drawing.Color.White;
37 label.AutoSize = true;
38 label.Location = new System.Drawing.Point(10, 20);
39 infoPanel.Controls.Add(label);
40
41 // Layout mit InfoPanel + 3D-Plot
42 var layout = new TableLayoutPanel();
43 layout.Dock = DockStyle.Fill;
44 layout.ColumnCount = 2;
45 layout.RowCount = 1;
46 layout.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 200));
47 layout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100));
48 layout.Controls.Add(infoPanel, 0, 0);
49 layout.Controls.Add(host, 1, 0);
50 this.Controls.Add(layout);
51 }
52 else
53 {
54 // Nur 3D-Plot, kein Panel
55 this.Controls.Add(host);
56 }
57
58 View3D.PlotSurfaceLevel(
59 scalarField3D,
60 -5, 5, -5, 5,
61 zFixed, resolution
62 );
63 }
64
65
66
67
68 public ScalarField3DView View3D { get; private set; }
69 }
70}
PlotForm3D(Func< double, double, double, double > scalarField3D, double zFixed, int resolution=80, string? gradientText=null)
Definition PlotForm3D.cs:10