//инициализация начальных переменных программы private void InitStartParams() { FirstForm = true; View3D = false; act_quant = 7; d_link = true; d_in = 1; // угол illumination = false; wheel_vis = true; drill_vis = true; O = Math.PI * 1 / 180; R = 0.5; array = new Point[act_quant]; arrayO = new Point[act_quant]; arraySV = new Point[act_quant]; array3D = new Point[act_quant]; for (int i = 0; i < act_quant; i++) { array[i] = new Point(); arrayO[i] = new Point(); arraySV[i] = new Point(); array3D[i] = new Point(); } trackBar2.Value = trackBar2.Maximum / 2; trackBar3.Value = trackBar3.Maximum / 3; trackBar3_Scroll(null, null); }
public void RefreshPoints() { double L, dL; int i; int act_quant = 51; _form2.richTextBox1.Clear(); string str; _form2.richTextBox1.Text += "L\t\tX0\t\tZ0"; _form2.richTextBox1.Text += "\n\n"; dL = (Le - Ln) / (act_quant - 1); CalcXY(); for (i = 0; i < act_quant; i++) { L = dL * i + Ln; str = String.Format("{0:0.000000}\t\t{1:0.000000}\t\t{2:0.000000}", Math.Round(L, 6), Math.Round(_form2.array1[i].X, 6), Math.Round(_form2.array1[i].Z, 6)) + "\n"; _form2.richTextBox1.Text += str; } Point C = new Point(); Point a, b, c; double Ro; C.Set(0, 0, 0); a = _form2.array1[0].Clone(); b = _form2.array1[act_quant / 4].Clone(); b.Substr(a); c = _form2.array1[act_quant / 2].Clone(); c.Substr(a); C.X = 2 * (b.Z * c.X - c.Z * b.X); if ((C.X > -0.0000001) && (C.X < 0.00000001)) { C.X = 999999999; } else { C.X = (b.Z * (c.Z * c.Z + c.X * c.X) - c.Z * (b.Z * b.Z + b.X * b.X)) / C.X; } C.Z = 2 * b.Z; if ((C.Z > -0.0000001) && (C.Z < 0.00000001)) { C.Z = 999999999; } else { C.Z = (b.X * b.X - 2 * b.X * C.X + b.Z * b.Z) / C.Z; } Ro = Math.Sqrt(C.X * C.X + C.Z * C.Z); C.Add(a); for (i = 0; i < act_quant / 2; i++) { a = _form2.array1[i].Clone(); a.Substr(C); a.Normaliz(); a.MultConst(Ro); a.Add(C); _form2.arrayO[i].Z = a.Z; _form2.arrayO[i].X = a.X; } _form2.richTextBox1.Text += "\n"; str = "Шаг 2D сетки = 0.1 ед\n"; _form2.richTextBox1.Text += str; _form2.richTextBox1.Text += "\n"; str = "Радиус аппроксимирующих окружностей = " + Math.Round(Ro, 6) + "\n"; _form2.richTextBox1.Text += str; str = "Коорд. окр. 1: Z=" + Math.Round(C.Z, 6) + " X=" + Math.Round(C.X, 6) + "\n"; _form2.richTextBox1.Text += str; int numberElement = act_quant / 2; double temp = _form2.array1[numberElement].Z; double doub = 2 * temp; double cs = -C.Z; double coord2 = -C.Z + 2 * _form2.array1[act_quant / 2].Z; str = "Коорд. окр. 2: Z=" + Math.Round(coord2, 6) + " X=" + Math.Round(C.X, 6) + "\n"; _form2.richTextBox1.Text += str; str = "Сумма максимальных отклонение = " + Math.Round((double)CalcE(), 6); _form2.richTextBox1.Text += str; DrawChart(); _form2.Show3D(); }