/// <summary> /// 求解七参数 /// </summary> /// <param name="knownPoints">已知点构成的点集</param> /// <param name="B"></param> /// <param name="N"></param> /// <returns>七参数构成的数组</returns> public static double[,] ComputeSevenParameter(List <Point> knownPoints, out double[,] B, out double[,] N) { Martix tempB = new Martix(GetB(knownPoints)); Martix l = new Martix(Getl(knownPoints)); Martix tempN = tempB.Transpose() * tempB; Martix W = tempB.Transpose() * l; Martix x = tempN.Inverse(tempN.Element) * W; Martix V = tempB * x - l; string str = FileHandle.ArrayToStr(tempN.Element); B = tempB.Element; N = tempN.Element; return(x.Element); }
private void menuSaveDXF_Click(object sender, EventArgs e) { try { if (isTransformation) { saveFileDialog1.Filter = "(dxf文件)|*.dxf"; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { FileHandle.SaveDxf(saveFileDialog1.FileName, knownPoints, unknownPoints); MessageBox.Show("保存成功"); } } else { MessageBox.Show("请先完成计算"); } } catch (Exception ex) { MessageBox.Show("保存失败\n错误信息:" + ex.Message); } }
private void menuSaveReport_Click(object sender, EventArgs e) { try { if (isTransformation) { saveFileDialog1.Filter = "(txt文件)|*.txt"; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { FileHandle.SaveReport(saveFileDialog1.FileName, report); MessageBox.Show("保存成功"); } } else { MessageBox.Show("请先完成计算"); } } catch (Exception ex) { MessageBox.Show("保存失败\n错误信息:" + ex.Message); } }
private void menuReadData_Click(object sender, EventArgs e) { try { openFileDialog1.Filter = "(txt文件)|*.txt"; if (openFileDialog1.ShowDialog() == DialogResult.OK) { FileHandle.ReadData(openFileDialog1.FileName, out knownPoints, out unknownPoints); dataGridView1.DataSource = FileHandle.ToDataTable(knownPoints, unknownPoints); testA = FileHandle.A; testB = FileHandle.B; isOpen = true; isComputeSevenPara = false; isTransformation = false; chart1.Series.Clear(); MessageBox.Show("打开成功"); } } catch (Exception ex) { MessageBox.Show("打开失败\n错误信息:" + ex.Message); } }