private void ZRotationBar_Scroll(object sender, EventArgs e) { if (autoUpdate) { GraphicsPanel.Refresh(); } }
private void ScaleFactorBar_ValueChanged(object sender, EventArgs e) { if (autoUpdate) { GraphicsPanel.Refresh(); } }
private void HValue_ValueChanged(object sender, EventArgs e) { UpdateHyperboloid(); if (autoUpdate) { GraphicsPanel.Refresh(); } }
private void GraphicsPanel_Resize(object sender, EventArgs e) { graphics?.Dispose(); graphics = GraphicsPanel.CreateGraphics(); if (autoUpdate) { GraphicsPanel.Refresh(); } }
private void MainForm_Load(object sender, EventArgs e) { UpdateHyperboloid(); autoUpdate = AutoUpdateBox.Checked; AutoUpdateBox_CheckedChanged(this, null); graphics = GraphicsPanel.CreateGraphics(); SmoothBox_CheckedChanged(this, null); AddToChartButton_Click(this, null); }
private void AutoUpdateBox_CheckedChanged(object sender, EventArgs e) { autoUpdate = AutoUpdateBox.Checked; if (autoUpdate) { DrawButton.Enabled = false; GraphicsPanel.Refresh(); } else { DrawButton.Enabled = true; } }
private void SmoothBox_CheckedChanged(object sender, EventArgs e) { if (graphics is null) { return; } if (SmoothBox.Checked) { graphics.SmoothingMode = SmoothingMode.AntiAlias; } else { graphics.SmoothingMode = SmoothingMode.None; } if (autoUpdate) { GraphicsPanel.Refresh(); } }
private void GraphicsPanel_Paint(object sender, PaintEventArgs e) { var centerCircle = (Circle)hyperboloid.GetZAxisSection(0); var upCircle = (Circle)hyperboloid.GetZAxisSection(hyperboloid.MaxZ); var downCircle = (Circle)hyperboloid.GetZAxisSection(hyperboloid.MinZ); graphicsEngine.Figures3D.Clear(); graphicsEngine.Figures2D.Clear(); graphicsEngine.Figures3D.Add((hyperboloid, Color.White)); graphicsEngine.Figures2D.Add((centerCircle, 0, Color.Black)); graphicsEngine.Figures2D.Add((upCircle, hyperboloid.MaxZ, Color.Red)); graphicsEngine.Figures2D.Add((downCircle, hyperboloid.MinZ, Color.Red)); graphicsEngine.ZeroPositionOffset = new Point3D((double)GraphicsPanel.Width / 2, (double)GraphicsPanel.Height / 2, 0); graphicsEngine.Figures3DStep = (double)StepBar.Value / 10; graphicsEngine.Figures2DStep = (double)StepBar.Value / 50; graphicsEngine.ScaleFactor = (double)ScaleFactorBar.Value / 10; graphicsEngine.Rotation = Vector3D.FromDegrees(XRotationBar.Value, YRotationBar.Value, ZRotationBar.Value); GraphicsPanel.SuspendLayout(); graphicsEngine.Draw(graphics); GraphicsPanel.ResumeLayout(); }
private void DrawButton_Click(object sender, EventArgs e) { GraphicsPanel.Refresh(); }