DLT 直接線性變換解法程序_第1頁(yè)
DLT 直接線性變換解法程序_第2頁(yè)
DLT 直接線性變換解法程序_第3頁(yè)
DLT 直接線性變換解法程序_第4頁(yè)
DLT 直接線性變換解法程序_第5頁(yè)
已閱讀5頁(yè),還剩15頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、DLT 直接線性變換解法程序介紹一、程序綜合介紹:DLT結(jié)算程序 程序功能介紹: 應(yīng)用6個(gè)已知點(diǎn)計(jì)算左右片l 系數(shù);然后應(yīng)用已經(jīng)求得的l系數(shù)求解物方空間坐標(biāo)系坐標(biāo)程序名:SuYGDLT程序界面:程序界面有四個(gè)按鈕,分別為讀取文件,左片l系數(shù)計(jì)算,右片系數(shù)計(jì)算,物放坐標(biāo)解算程序界面有四個(gè)編輯框,分別用來(lái)輸出文件信息,左片l系數(shù)、右片l系數(shù)、以及無(wú)妨坐標(biāo)結(jié)果截圖如下程序使用介紹:必須先點(diǎn)擊導(dǎo)入文件按鈕,導(dǎo)入文件方可進(jìn)行正確的計(jì)算,如果未導(dǎo)入文件就點(diǎn)擊左片平差或右片平差或無(wú)妨坐標(biāo)解算就會(huì)彈出如下對(duì)話框:讀取數(shù)據(jù)后點(diǎn)擊其它按鈕進(jìn)行其它計(jì)算。程序文件格式:數(shù)據(jù)文件分為兩部分,KnownPoint,UNK

2、nownPoint,分別代表已知點(diǎn)信息和待求點(diǎn)信息當(dāng)文件讀取程序讀到“KnownPoint”時(shí)開(kāi)始讀取已知點(diǎn)信息,已知點(diǎn)信息格式如下GCP1,1214.0000,1032.0000,1046.5180,1071.6652,9.201742,-9.672384,-2.726064分別代表點(diǎn)名、左片相片X坐標(biāo)、左片相片y坐標(biāo)、右片相片x坐標(biāo)、右片相片y坐標(biāo) 物方坐標(biāo)X、Y、Z;當(dāng)文件讀取到“END KnownPoint”時(shí)結(jié)束已知坐標(biāo)的讀取待求點(diǎn)信息類(lèi)似:文件格式截圖如下:程序運(yùn)行結(jié)果與評(píng)估:本程序區(qū)1-10號(hào)點(diǎn)作為已知點(diǎn)計(jì)算l近似值 11-20號(hào)點(diǎn)作為未知點(diǎn)解求其物方三維坐標(biāo);程序運(yùn)行結(jié)果與所給

3、參考值相似,應(yīng)該可以證明其運(yùn)算是正確的,運(yùn)行結(jié)果截圖如下:二、程序編程思想及相關(guān)代碼程序編程思想及相關(guān)函數(shù):本程序設(shè)計(jì)DLTCalculation類(lèi)作為l系數(shù)結(jié)算主程序,其成員變量及成員函數(shù)與作用介紹如下:CSuLMatrix LL;/左片L系數(shù)矩陣CSuLMatrix RL;/右片L系數(shù)矩陣int m_iKnownPointCount;/已知點(diǎn)個(gè)數(shù)CControlPoint *m_pKnownPoint;/已知點(diǎn)int m_iUnKnownPointCount;/未知點(diǎn)個(gè)數(shù)CControlPoint *m_pUnKnownPoint;/未知點(diǎn)public:CString LoadData(c

4、onst CString& strFileName);/讀取文件函數(shù) int ifLoda;/判斷是否導(dǎo)入數(shù)據(jù)CString Datainfor;/文件信息存儲(chǔ)CString *SplitString(CString str,char split, int& iSubStrs); /分割函數(shù)void LFormApproL(CSuLMatrix &LL);/計(jì)算左片L系數(shù)近似值void RFormApproL(CSuLMatrix &RL);/計(jì)算右片L系數(shù)近似值void FormLErrorEquations(CSuLMatrix LL,CMatrix &am

5、p;LM,CMatrix &LW);/組成左片系數(shù)矩陣和常數(shù)項(xiàng)矩陣void LAdjust();/左片平差主函數(shù)void FormRErrorEquations(CSuLMatrix RL,CMatrix &RM,CMatrix &RW);/組成右片系數(shù)矩陣和常數(shù)項(xiàng)矩陣void RAdjust();/右片平差主函數(shù)void Output(const CString& strFileName);/輸出結(jié)果主程序void OutMatrixToFile(const CMatrix& mat,CStdioFile& SF);/輸出矩陣總程序另外設(shè)計(jì)類(lèi)q

6、ianfangjiaohui作為結(jié)算物放坐標(biāo)解算主程序其成員變量與成員函數(shù)及其作用介紹如下:void FormApproCoor( DLTCalculation &R);/計(jì)算無(wú)妨坐標(biāo)近似值void FormErrorEquations(DLTCalculation &R,CMatrix &N,CMatrix &Q);/解求系數(shù)矩陣void Adjust(DLTCalculation &R);/平差計(jì)算物放坐標(biāo)程序詳細(xì)代碼粘貼如下:以下為類(lèi) DLTCalculation.cpp文件詳細(xì)內(nèi)容:#include "StdAfx.h"#in

7、clude "DLTCalculation.h"#include <locale>#include "SuLMatrix.h"DLTCalculation:DLTCalculation(void)ifLoda=0;DLTCalculation:DLTCalculation(void)CString* DLTCalculation:SplitString(CString str,char split, int& iSubStrs)int iPos = 0; /分割符位置int iNums = 0; /分割符的總數(shù)CString strT

8、emp = str;CString strRight;/先計(jì)算子字符串的數(shù)量while (iPos != -1)iPos = strTemp.Find(split);if (iPos = -1)break;strRight = strTemp.Mid(iPos + 1, str.GetLength();strTemp = strRight;iNums+;if (iNums = 0) /沒(méi)有找到分割符/子字符串?dāng)?shù)就是字符串本身iSubStrs = 1; return NULL;/子字符串?dāng)?shù)組iSubStrs = iNums + 1; /子串的數(shù)量= 分割符數(shù)量+ 1CString* pStrSp

9、lit;pStrSplit = new CStringiSubStrs;strTemp = str;CString strLeft;for (int i = 0; i < iNums; i+)iPos = strTemp.Find(split);/左子串strLeft = strTemp.Left(iPos);/右子串strRight = strTemp.Mid(iPos + 1, strTemp.GetLength();strTemp = strRight;pStrSpliti = strLeft;pStrSplitiNums = strTemp;return pStrSplit;CS

10、tring DLTCalculation:LoadData(const CString& strFileName) ifLoda=1;CString strputdata;/用于保存觀測(cè)文件的字符串CStdioFile sf;/創(chuàng)建文件對(duì)象setlocale(LC_ALL,""); /設(shè)置語(yǔ)言環(huán)境if(!sf.Open(strFileName, CFile:modeRead) return _T("文件打開(kāi)失敗");/以讀的形式打來(lái)文件,如果打開(kāi)失敗則返回CString strLine;int n;CString *strTmp=NULL;dos

11、f.ReadString (strLine);strputdata+=strLine;strputdata+=_T("rn");while(strLine!="KnownPoint");Datainfor=strputdata;if(strLine="KnownPoint")/讀取已知數(shù)據(jù)while(strLine!=_T("END KnownPoint")sf.ReadString (strLine);strputdata+=strLine;strputdata+=_T("rn");if(st

12、rLine!=_T("END KnownPoint")strTmp = SplitString(strLine, ',',n);elsebreak;if(strTmp0="KnownPointCount")m_iKnownPointCount=_ttoi(strTmp1);m_pKnownPoint=new CControlPointm_iKnownPointCount;if(strTmp!=NULL)/釋放內(nèi)存delete strTmp;strTmp=NULL;for(int i=0;i<m_iKnownPointCount;i+

13、)sf.ReadString (strLine);strputdata+=strLine;strputdata+=_T("rn");strTmp = SplitString(strLine, ',',n);m_pKnownPointi.strName =strTmp0;m_pKnownPointi.Lx =_tstof(strTmp1);m_pKnownPointi.Ly =_tstof(strTmp2);m_pKnownPointi.Rx =_tstof(strTmp3);m_pKnownPointi.Ry =_tstof(strTmp4);m_pKnow

14、nPointi.X =_tstof(strTmp5);m_pKnownPointi.Y =_tstof(strTmp6);m_pKnownPointi.Z =_tstof(strTmp7);if(strTmp!=NULL)/釋放內(nèi)存delete strTmp;strTmp=NULL;sf.ReadString (strLine);strputdata+=strLine;strputdata+=_T("rn");if(strLine="UnknownPoint")/讀取未知數(shù)據(jù) while(strLine!=_T("END UnknownPoin

15、t")sf.ReadString (strLine);strputdata+=strLine;strputdata+=_T("rn");if(strLine!=_T("END UnknownPoint")strTmp = SplitString(strLine, ',',n);else break;if(strTmp0="UnknownPointCount")m_iUnKnownPointCount=_ttoi(strTmp1);m_pUnKnownPoint=new CControlPointm_iUnKn

16、ownPointCount;if(strTmp!=NULL)/釋放內(nèi)存delete strTmp;strTmp=NULL;for(int i=0;i<m_iUnKnownPointCount;i+)sf.ReadString (strLine);strputdata+=strLine;strputdata+=_T("rn");strTmp = SplitString(strLine, ',',n);m_pUnKnownPointi.strName =strTmp0;m_pUnKnownPointi.Lx =_tstof(strTmp1);m_pUnKn

17、ownPointi.Ly =_tstof(strTmp2);m_pUnKnownPointi.Rx =_tstof(strTmp3);m_pUnKnownPointi.Ry =_tstof(strTmp4);if(strTmp!=NULL)/釋放內(nèi)存delete strTmp;strTmp=NULL;sf.Close ();return strputdata;void DLTCalculation:LFormApproL(CSuLMatrix &LL)/計(jì)算左片L系數(shù)近似值CMatrix LX(11,1);CMatrix LB(11,11);CMatrix Lf(11,1);for(i

18、nt i=0;i<5;i+)LB(2*i,0) = LB(2*i+1,4) = m_pKnownPointi.X*1000;LB(2*i,1) = LB(2*i+1,5) = m_pKnownPointi.Y*1000;LB(2*i,2) = LB(2*i+1,6) = m_pKnownPointi.Z*1000;LB(2*i,3) = LB(2*i+1,7) = 1;LB(2*i,4) = LB(2*i,5) = LB(2*i,6) = LB(2*i,7) = LB(2*i+1,0) = LB(2*i+1,1) = LB(2*i+1,2) = LB(2*i+1,3) = 0;LB(2*

19、i,8) = m_pKnownPointi.Lx * m_pKnownPointi.X*1000;LB(2*i,9) = m_pKnownPointi.Lx * m_pKnownPointi.Y*1000;LB(2*i,10) = m_pKnownPointi.Lx * m_pKnownPointi.Z*1000;LB(2*i+1,8) = m_pKnownPointi.Ly * m_pKnownPointi.X*1000;LB(2*i+1,9) = m_pKnownPointi.Ly * m_pKnownPointi.Y*1000;LB(2*i+1,10) = m_pKnownPointi.

20、Ly * m_pKnownPointi.Z*1000;LB(10,0) = m_pKnownPoint5.X*1000;LB(10,1) = m_pKnownPoint5.Y*1000;LB(10,2) = m_pKnownPoint5.Z*1000;LB(10,3) = 1;LB(10,4) = LB(10,5) = LB(10,6) = LB(10,7) = 0;LB(10,8) = m_pKnownPoint5.Lx * m_pKnownPoint5.X*1000;LB(10,9) = m_pKnownPoint5.Lx * m_pKnownPoint5.Y*1000;LB(10,10)

21、 = m_pKnownPoint5.Lx * m_pKnownPoint5.Z*1000;for(int i=0;i<5;i+)Lf(2*i,0) = m_pKnownPointi.Lx;Lf(2*i+1,0) = m_pKnownPointi.Ly;Lf(10,0) = m_pKnownPoint5.Lx;LX = (-1)*(LB.Inv()*Lf;LL.l1 = LX(0,0);LL.l2 = LX(1,0);LL.l3 = LX(2,0);LL.l4 = LX(3,0);LL.l5 = LX(4,0);LL.l6 = LX(5,0);LL.l7 = LX(6,0);LL.l8 =

22、 LX(7,0);LL.l9 = LX(8,0);LL.l10 = LX(9,0);LL.l11 = LX(10,0);void DLTCalculation:RFormApproL(CSuLMatrix &RL)/計(jì)算右片L系數(shù)近似值CMatrix RX(11,1);CMatrix RB(11,11);CMatrix Rf(11,1);for(int i=0;i<5;i+)RB(2*i,0) = RB(2*i+1,4) = m_pKnownPointi.X*1000;RB(2*i,1) = RB(2*i+1,5) = m_pKnownPointi.Y*1000;RB(2*i,2

23、) = RB(2*i+1,6) = m_pKnownPointi.Z*1000;RB(2*i,3) = RB(2*i+1,7) = 1;RB(2*i,4) = RB(2*i,5) = RB(2*i,6) = RB(2*i,7) = RB(2*i,7) = RB(2*i+1,0) = RB(2*i+1,1) = RB(2*i+1,2) = RB(2*i+1,3) = 0;RB(2*i,8) = m_pKnownPointi.Rx * m_pKnownPointi.X*1000;RB(2*i,9) = m_pKnownPointi.Rx * m_pKnownPointi.Y*1000;RB(2*i

24、,10) = m_pKnownPointi.Rx * m_pKnownPointi.Z*1000;RB(2*i+1,8) = m_pKnownPointi.Ry * m_pKnownPointi.X*1000;RB(2*i+1,9) = m_pKnownPointi.Ry * m_pKnownPointi.Y*1000;RB(2*i+1,10) = m_pKnownPointi.Ry * m_pKnownPointi.Z*1000;RB(10,0) = m_pKnownPoint5.X*1000;RB(10,1) = m_pKnownPoint5.Y*1000;RB(10,2) = m_pKn

25、ownPoint5.Z*1000;RB(10,3) = 1;RB(10,4) = RB(10,5) = RB(10,6) = RB(10,7) = 0;RB(10,8) = m_pKnownPoint5.Rx * m_pKnownPoint5.X*1000;RB(10,9) = m_pKnownPoint5.Rx * m_pKnownPoint5.Y*1000;RB(10,10) = m_pKnownPoint5.Rx * m_pKnownPoint5.Z*1000;for(int i=0;i<5;i+)Rf(2*i,0) = m_pKnownPointi.Rx;Rf(2*i+1,0)

26、= m_pKnownPointi.Ry;Rf(10,0) = m_pKnownPoint5.Rx;RX = (-1)*(RB.Inv()*Rf;RL.l1 = RX(0,0);RL.l2 = RX(1,0);RL.l3 = RX(2,0);RL.l4 = RX(3,0);RL.l5 = RX(4,0);RL.l6 = RX(5,0);RL.l7 = RX(6,0);RL.l8 = RX(7,0);RL.l9 = RX(8,0);RL.l10 = RX(9,0);RL.l11 = RX(10,0);void DLTCalculation:FormLErrorEquations(CSuLMatri

27、x LL,CMatrix &LM,CMatrix &LW)/組成左片系數(shù)矩陣和常數(shù)項(xiàng)矩陣LM.SetSize(2*m_iUnKnownPointCount,12);LW.SetSize(2*m_iUnKnownPointCount,1);/LFormApproL(LL);double A;double x0,y0;double r;for(int i=0;i<m_iKnownPointCount;i+)A = LL.l9 * m_pKnownPointi.X * 1000 + LL.l10 * m_pKnownPointi.Y * 1000 + LL.l1 * m_pKn

28、ownPointi.Z * 1000 + 1; x0 = (-1)*(LL.l1 * LL.l9 + LL.l2 * LL.l10 + LL.l3 * LL.l11)/(LL.l9 * LL.l9 + LL.l10 * LL.l10 + LL.l11 * LL.l11);y0 = (-1)*(LL.l5 * LL.l9 + LL.l6 * LL.l10 + LL.l7 * LL.l11)/(LL.l9 * LL.l9 + LL.l10 * LL.l10 + LL.l11 * LL.l11);r = sqrt(m_pKnownPointi.Lx-x0)*(m_pKnownPointi.Lx-x0

29、) + (m_pKnownPointi.Ly-y0)*(m_pKnownPointi.Ly-y0);LM(2*i,0) = LM(2*i+1,4) = (-1)*m_pKnownPointi.X * 1000 /A;LM(2*i,1) = LM(2*i+1,5) = (-1)*m_pKnownPointi.Y * 1000 /A;LM(2*i,2) = LM(2*i+1,6) = (-1)*m_pKnownPointi.Z * 1000 /A;LM(2*i,3) = LM(2*i+1,7) = (-1)*1/A;LM(2*i,4) = LM(2*i,5) = LM(2*i,6) = LM(2*

30、i,7) = LM(2*i+1,0) = LM(2*i+1,1) = LM(2*i+1,2) = LM(2*i+1,3) = 0;LM(2*i,8) = (-1)*m_pKnownPointi.Lx * m_pKnownPointi.X* 1000 /A;LM(2*i,9) = (-1)*m_pKnownPointi.Lx * m_pKnownPointi.Y* 1000 /A;LM(2*i,10) = (-1)*m_pKnownPointi.Lx * m_pKnownPointi.Z* 1000 /A;LM(2*i,11) = (-1)*(m_pKnownPointi.Lx - x0) *

31、r * r;LM(2*i+1,8) = (-1)*m_pKnownPointi.Ly * m_pKnownPointi.X* 1000 /A;LM(2*i+1,9) = (-1)*m_pKnownPointi.Ly * m_pKnownPointi.Y* 1000 /A;LM(2*i+1,10) = (-1)*m_pKnownPointi.Ly * m_pKnownPointi.Z* 1000 /A;LM(2*i+1,11) = (-1)*(m_pKnownPointi.Ly - y0) * r * r;LW(2*i,0) = (-1)*m_pKnownPointi.Lx/A;LW(2*i+1

32、,0) = (-1)*m_pKnownPointi.Ly/A;void DLTCalculation:OutMatrixToFile(const CMatrix& mat,CStdioFile& SF) CString strLine,strTmp;for(int i=0;i<mat.Row();i+)strLine.Empty();for(int j=0;j<mat.Col();j+)strTmp.Format(_T("%.4f "),mat(i,j);strLine=strLine+strTmp;SF.WriteString(strLine+

33、_T("rn");void DLTCalculation:LAdjust()/左片平差主函數(shù)CMatrix LM(2*m_iUnKnownPointCount,12);CMatrix LW(2*m_iUnKnownPointCount,1);CMatrix LNbb(12,12);CMatrix LNvv(12,1);CMatrix LV(12,1);int Ln = 0;CString strputdata;double x0,y0;double A,B,C;double fx;double x00,y00;double A0,B0,C0;double fx0;doubl

34、e dfx;LFormApproL(LL);x00 = (-1)*(LL.l1 * LL.l9 + LL.l2 * LL.l10 + LL.l3 * LL.l11)/(LL.l9 * LL.l9 + LL.l10 * LL.l10 + LL.l11 * LL.l11);y00 = (-1)*(LL.l5 * LL.l9 + LL.l6 * LL.l10 + LL.l7 * LL.l11)/(LL.l9 * LL.l9 + LL.l10 * LL.l10 + LL.l11 * LL.l11);A0 = (LL.l1 * LL.l1 + LL.l2 * LL.l2 + LL.l3 * LL.l3)

35、/(LL.l9 * LL.l9 + LL.l10 * LL.l10 + LL.l11 * LL.l11)-x00*x00;B0 = (LL.l5 * LL.l5 + LL.l6 * LL.l6 + LL.l7 * LL.l7)/(LL.l9 * LL.l9 + LL.l10 * LL.l10 + LL.l11 * LL.l11)-y00*y00;C0 = (LL.l1 * LL.l5 + LL.l2 * LL.l6 + LL.l3 * LL.l7)/(LL.l9 * LL.l9 + LL.l10 * LL.l10 + LL.l11 * LL.l11)-x00*y00;fx0 = sqrt(A0

36、*B0-C0*C0)/B0);/*doFormLErrorEquations(LL,LM,LW);LNbb=(LM)*LM;LNvv=(LM)*LW;LV=(LNbb.Inv()*LNvv;LL.l1=LV(0,0);LL.l2=LV(1,0);LL.l3=LV(2,0);LL.l4=LV(3,0);LL.l5=LV(4,0);LL.l6=LV(5,0);LL.l7=LV(6,0);LL.l8=LV(7,0);LL.l9=LV(8,0);LL.l10=LV(9,0);LL.l11=LV(10,0);x0 = (-1)*(LL.l1 * LL.l9 + LL.l2 * LL.l10 + LL.l

37、3 * LL.l11)/(LL.l9 * LL.l9 + LL.l10 * LL.l10 + LL.l11 * LL.l11);y0 = (-1)*(LL.l5 * LL.l9 + LL.l6 * LL.l10 + LL.l7 * LL.l11)/(LL.l9 * LL.l9 + LL.l10 * LL.l10 + LL.l11 * LL.l11);A = (LL.l1 * LL.l1 + LL.l2 * LL.l2 + LL.l3 * LL.l3)/(LL.l9 * LL.l9 + LL.l10 * LL.l10 + LL.l11 * LL.l11)-x0*x0;B = (LL.l5 * L

38、L.l5 + LL.l6 * LL.l6 + LL.l7 * LL.l7)/(LL.l9 * LL.l9 + LL.l10 * LL.l10 + LL.l11 * LL.l11)-y0*y0;C = (LL.l1 * LL.l5 + LL.l2 * LL.l6 + LL.l3 * LL.l7)/(LL.l9 * LL.l9 + LL.l10 * LL.l10 + LL.l11 * LL.l11)-x0*y0;fx = sqrt(A*B-C*C)/B);dfx = fx - fx0;fx0 = fx;Ln+;while(fabs(dfx)>0.01);*/void DLTCalculati

39、on:Output(const CString& strFileName)CStdioFile SF;CString strLine;setlocale(LC_ALL,""); if(!SF.Open(strFileName, CFile:modeCreate|CFile:modeWrite) return;/開(kāi)始寫(xiě)數(shù)據(jù)SF.WriteString(_T("結(jié)果輸出:n"); SF.WriteString(_T("空間后方交匯n");CMatrix LM(2*m_iKnownPointCount,12);CMatrix LW(

40、2*m_iKnownPointCount,1);CMatrix LNbb(12,12);CMatrix LNvv(12,1);CMatrix LV(12,1);int Ln = 0;CString strputdata;double x0,y0;double A,B,C;double fx;double x00,y00;double A0,B0,C0;double fx0;double dfx;LFormApproL(LL);x00 = (-1)*(LL.l1 * LL.l9 + LL.l2 * LL.l10 + LL.l3 * LL.l11)/(LL.l9 * LL.l9 + LL.l10

41、* LL.l10 + LL.l11 * LL.l11);y00 = (-1)*(LL.l5 * LL.l9 + LL.l6 * LL.l10 + LL.l7 * LL.l11)/(LL.l9 * LL.l9 + LL.l10 * LL.l10 + LL.l11 * LL.l11);A0 = (LL.l1 * LL.l1 + LL.l2 * LL.l2 + LL.l3 * LL.l3)/(LL.l9 * LL.l9 + LL.l10 * LL.l10 + LL.l11 * LL.l11)-x00*x00;B0 = (LL.l5 * LL.l5 + LL.l6 * LL.l6 + LL.l7 *

42、LL.l7)/(LL.l9 * LL.l9 + LL.l10 * LL.l10 + LL.l11 * LL.l11)-y00*y00;C0 = (LL.l1 * LL.l5 + LL.l2 * LL.l6 + LL.l3 * LL.l7)/(LL.l9 * LL.l9 + LL.l10 * LL.l10 + LL.l11 * LL.l11)-x00*y00;fx0 = sqrt(A0*B0-C0*C0)/B0);/*do*/FormLErrorEquations(LL,LM,LW);LNbb=(LM)*LM;LNvv=(LM)*LW;OutMatrixToFile(LM,SF);/*LV=LN

43、bb.Inv();*/*LV=(LNbb.Inv()*LNvv;*/*LL.l1+=LV(0,0);LL.l2+=LV(1,0);LL.l3+=LV(2,0);LL.l4+=LV(3,0);LL.l5+=LV(4,0);LL.l6+=LV(5,0);LL.l7+=LV(6,0);LL.l8+=LV(7,0);LL.l9+=LV(8,0);LL.l10+=LV(9,0);LL.l11+=LV(10,0);x0 = (-1)*(LL.l1 * LL.l9 + LL.l2 * LL.l10 + LL.l3 * LL.l11)/(LL.l9 * LL.l9 + LL.l10 * LL.l10 + LL

44、.l11 * LL.l11);y0 = (-1)*(LL.l5 * LL.l9 + LL.l6 * LL.l10 + LL.l7 * LL.l11)/(LL.l9 * LL.l9 + LL.l10 * LL.l10 + LL.l11 * LL.l11);A = (LL.l1 * LL.l1 + LL.l2 * LL.l2 + LL.l3 * LL.l3)/(LL.l9 * LL.l9 + LL.l10 * LL.l10 + LL.l11 * LL.l11)-x0*x0;B = (LL.l5 * LL.l5 + LL.l6 * LL.l6 + LL.l7 * LL.l7)/(LL.l9 * LL

45、.l9 + LL.l10 * LL.l10 + LL.l11 * LL.l11)-y0*y0;C = (LL.l1 * LL.l5 + LL.l2 * LL.l6 + LL.l3 * LL.l7)/(LL.l9 * LL.l9 + LL.l10 * LL.l10 + LL.l11 * LL.l11)-x0*y0;fx = sqrt(A*B-C*C)/B);dfx = fx - fx0;fx0 = fx;Ln+;*/while(fabs(dfx)>0.01);CString putdata;putdata.Format(_T("%srn"),_T("左片結(jié)果&

46、quot;);strputdata+=putdata;putdata.Format(_T("%srn"),_T("L系數(shù)為:");strputdata+=putdata;putdata.Format(_T("%s%.5frn%s%.5frn%s%.5frn%s%.5frn%s%.5frn%s%.5frn%s%.5frn%s%.5frn%s%.5frn%s%.5frn%s%.5frn"),_T("l1 = "),LL.l1,_T("l2 = "),LL.l2,_T("l3 = "

47、;),LL.l3,_T("l4 = "),LL.l4,_T("l5 = "),LL.l5,_T("l6 = "),LL.l6,_T("l7 = "),LL.l7,_T("l8 = "),LL.l8,_T("l9 = "),LL.l9,_T("l10 = "),LL.l10,_T("l11 = "),LL.l11);strputdata+=putdata;SF.WriteString(strputdata);/putdata.Format

48、(_T("%s%drn"),_T("迭代次數(shù)為:"),Ln);/*strputdata+=putdata;*/void DLTCalculation:RAdjust()/右片平差主函數(shù)CMatrix RM(2*m_iKnownPointCount,12);CMatrix RW(2*m_iKnownPointCount,1);CMatrix RNbb(12,12);CMatrix RNvv(12,1);CMatrix RV(12,1);int Rn = 0;CString strputdata;double x0,y0;double A,B,C;doubl

49、e fx;double x00,y00;double A0,B0,C0;double fx0;double dfx;RFormApproL(RL);/x00 = (-1)*(RL.l1 * RL.l9 + RL.l2 * RL.l10 + RL.l3 * RL.l11)/(RL.l9 * RL.l9 + RL.l10 * RL.l10 + RL.l11 * RL.l11);/y00 = (-1)*(RL.l5 * RL.l9 + RL.l6 * RL.l10 + RL.l7 * RL.l11)/(RL.l9 * RL.l9 + RL.l10 * RL.l10 + RL.l11 * RL.l11

50、);/A0 = (RL.l1 * RL.l1 + RL.l2 * RL.l2 + RL.l3 * RL.l3)/(RL.l9 * RL.l9 + RL.l10 * RL.l10 + RL.l11 * RL.l11)-x00*x00;/B0 = (RL.l5 * RL.l5 + RL.l6 * RL.l6 + RL.l7 * RL.l7)/(RL.l9 * RL.l9 + RL.l10 * RL.l10 + RL.l11 * RL.l11)-y00*y00;/C0 = (RL.l1 * RL.l5 + RL.l2 * RL.l6 + RL.l3 * RL.l7)/(RL.l9 * RL.l9 +

51、 RL.l10 * RL.l10 + RL.l11 * RL.l11)-x00*y00;/fx0 = sqrt(A0*B0-C0*C0)/B0);/*do*/FormRErrorEquations(RL,RM,RW);/RNbb = (RM)*RM;/RNvv = (RM)*RW;/*RV = (RNbb.Inv()*RNvv;*/RL.l1+=RV(0,0);RL.l2+=RV(1,0);RL.l3+=RV(2,0);RL.l4+=RV(3,0);/RL.l5+=RV(4,0);RL.l6+=RV(5,0);RL.l7+=RV(6,0);RL.l8+=RV(7,0);/RL.l9+=RV(8

52、,0);RL.l10+=RV(9,0);RL.l11+=RV(10,0);x0 = (-1)*(RL.l1 * RL.l9 + RL.l2 * RL.l10 + RL.l3 * RL.l11)/(RL.l9 * RL.l9 + RL.l10 * RL.l10 + RL.l11 * RL.l11);y0 = (-1)*(RL.l5 * RL.l9 + RL.l6 * RL.l10 + RL.l7 * RL.l11)/(RL.l9 * RL.l9 + RL.l10 * RL.l10 + RL.l11 * RL.l11);A = (RL.l1 * RL.l1 + RL.l2 * RL.l2 + RL

53、.l3 * RL.l3)/(RL.l9 * RL.l9 + RL.l10 * RL.l10 + RL.l11 * RL.l11)-x0*x0;B = (RL.l5 * RL.l5 + RL.l6 * RL.l6 + RL.l7 * RL.l7)/(RL.l9 * RL.l9 + RL.l10 * RL.l10 + RL.l11 * RL.l11)-y0*y0;C = (RL.l1 * RL.l5 + RL.l2 * RL.l6 + RL.l3 * RL.l7)/(RL.l9 * RL.l9 + RL.l10 * RL.l10 + RL.l11 * RL.l11)-x0*y0;/*fx = sqrt(A*B-C*C)/B);dfx = fx - fx0;fx0 = fx;Rn+;*/*while(abs(dfx)>0.01);*/類(lèi)qianfangjiaohui 的cpp文件代碼粘貼如下:#include "StdAfx.h"#include "qianfangjiaohui.h"qianfangjiaohui:qianfangjiaohui(void)qianfan

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論