DLT 直接线性变换解法程序
- 格式:doc
- 大小:224.50 KB
- 文档页数:20
DLT 算法1. DLT 的基本公式由空间射影定理所知:坐标变换时点的齐次坐标的变换是以线性齐次关系表示的,即为:⎪⎪⎭⎪⎪⎬⎫+++=+++=+++=+++=443424141433323131423222122413121111''''x D x C x B x A x x D x C x B x A x x D x C x B x A x x D x C x B x A x (2-1) 如用非齐次坐标来表示射线变换公式,则可用式(2-1)中的第四个式子逐项去除前三个式子,并令''',''',''',,,434241434241x x z x x y x x x x x Z x x Y x x X ======(2-2) 将式(2-2)代入式(2-1),可得:⎪⎪⎪⎭⎪⎪⎪⎬⎫++++++=++++++=++++++=444433334444222244441111'''D Z C Y B X A D Z C Y B X A z D Z C Y B X A D Z C Y B X A y D Z C Y B X A D Z C Y B X A x (2-3) (2-3)式为射影测量中表示三维的射影变换,如若表示二维的射影变换,即点)',','(z y x 满足某一平面方程,设这一平面方程为0'''=+++d cz by ax ,即'z 能由'x 、'y 表示,即(2-3)式中前两式与(2-3)式中三式等价。
当(2-3)式中前两式分子、分母同除以4D ,即有下式成立:⎪⎪⎭⎪⎪⎬⎫++++++=++++++=1'1'111098765111094321Z L Y L X L L Z L Y L X L y Z L Y L X L L Z L Y L X L x (2-4) 式(2-4)即为直接线性变换的基本公式,形式上与由共线条件方程导出的完全一样,但它比惯用的共线条件方程式具有一般的意义。
21立体摄影测量的基本原理0011 0010 1010 1101 0001 0100 10113.5 直接线性变化的基本原理和解算方法210011 0010 1010 1101 0001 0100 1011一、直接线性变化的关系式111333222333s s s i i i ()()()0()()()()()()0()()(),,,,s a b c i f s s s s s s s s s s s s a X X b Y Y c Z Z x f a X X b Y Y c Z Z a X X b Y Y c Z Z y f a X X b Y Y c Z Z X Y Z X Y Z -+-+-⎫+=⎪-+-+-⎪⎬-+-+-⎪+=⎪-+-+-⎭中心构像方程:其中:为物点的空间坐标 为光心的空间坐标 ,,(=1,2,3)旋转矩阵 所测x y 像片的主距,像点在摄影坐标系的坐标210011 0010 1010 1101 0001 0100 1011直接线性变化法•直接线性变换(DLT —Direct Linear Transformation )算法是直接建立像点坐标与物点空间坐标关系式的一种算法。
•该算法在机算中,不需要内、外方位元素。
而直接通过像点解算物点。
210011 0010 1010 1101 0001 0100 1011二、线性误差的修正1、线性误差:•底片均匀变形、不均匀变形•畸变差•x ,y 坐标轴不垂直2、线性修正ℓ系数假设主点坐标为(0,0)210011 0010 1010 1101 0001 0100 1011i i 12301231111s 1s 1s 1233333s 3s 3s 2222s 2s 2s 1233i x x y y a X+b Y+c Z (a X +b Y +c Z )f a X+b Y+c Z (a X +b Y +c Z )a X+b Y+c Z (a X +b Y +c Z )f a X x y y y x y x y x y αβαααβββαααβββ∴⎧+⎪⎨=-++⎪⎩+++0像片坐标系的坐标原点为主点设,(=1,2,3)为引入的线性修正系数=x-x ==+则==代入共线方程-++--+333s 3s 3s 1s 1s 1s 2s 2s 2s 33s 3s 3s +b Y+c Z (a X +b Y +c Z )r (a X +b Y +c Z )r (a X +b Y +c Z )r (a X +b Y +c Z )⎧⎪⎪⎨⎪⎪⎩⎧⎪⎨⎪⎩12-=-定义=-=-210011 0010 1010 1101 0001 0100 1011123491011567891011x y x 0101X Y Z X Y X X Y Z X Y X +++⎧=⎪+++⎪⎨+++⎪=⎪+++⎩其中上式为关于,的二元一次方程求解方程式:+y +系数为线性修正系数已知系数和物点坐标可以求解像点坐标210011 0010 1010 1101 0001 0100 1011三、内方位元素的解算11103332220333()()()0()()()()()()0()()()x y s s s x s s s s s s y s s s x y x x xy y y a X X b Y Y c Z Z x x f a X X b Y Y c Z Z a X X b Y Y c Z Z y y f a X X b Y Y c Z Z f f =-=--+-+-⎫-+=⎪-+-+-⎪⎬-+-+-⎪-+=⎪-+-+-⎭主点不在原点的共线方程为:其中,为像片在方向和方向的摄影主距210011 0010 1010 1101 0001 0100 101111110333311110333300a b c r 0a b c r a b c r 0a b c r x 0y 0x y X Y Z x x f X Y Z X Y Z y y f X Y Z x y ⎫-⎪⎪⎬⎪-⎪⎭⎫⎪⎪⎬⎪⎪⎭123491011567491011则上式可以简化为:++++=+++++++=+++合并,简化为下式:L X+L Y+L Z+L +=L X+L Y+L Z +1L X+L Y+L Z+L +=L X+L Y+L Z +1210011 0010 1010 1101 0001 0100 1011x x 33x x 33x x 33x x 333339333a f a xb f b x r rc f c x r f r x r r a f a x b f b x r r c f c x r f r x r r a b c r r r L L 130130121301303423023056230230781011求解系数:(-)(-)L = L =(-)(-)L = L =(-)(-)L = L =(-)(-)L = L == L = L =210011 0010 1010 1101 0001 0100 1011[]{[]}[][]x 31s 1s 1s x 3s 3s 3s 03s 1x 301x 301x 30s 3s s 1x 301x 301x 30s 3s r f r x r (a X +b Y +c Z )f (a X +b Y +c Z )x r a f a x b f b x c f c x r a f a x b f b x c f c x r X Y Z X Y Z ∴-⎡⎤⎢⎥-⎢⎥⎢⎥-⎣⎦-⎡⎤⎢⎥-⎢⎥⎢⎥-⎣⎦13048(-)L =1=---1 =---1同理:L =---210011 0010 1010 1101 0001 0100 1011x 0111s y 0222s 3333s f 0x a b c 1000f y a b c 010r 001a b c 001X Y Z ⎡⎤⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎣⎦⎡⎤⎡⎤⎡⎤⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎣⎦⎣⎦⎣⎦888888888888可建立L的系数矩阵L L L L L L L =L L L L L L --1=---210011 0010 1010 1101 0001 0100 1011391011333i i i 22233131313222222233323s 3s 3s 19210311222x 131313033232223323a b c a b c 1a a b b c c 01(a b c )r (a X +b Y +c Z )f a a b b c c x a b c r x a b c r x L L L L L L L L L L ∴⎧⎪⎨⎪⎩++=∴++⎡⎤⎣⎦00,,之间存在下列关系式:++=++=由矩阵有:++=又1 =(++)-(++) =-(++)=-()()910119101191011222222019210311222059610711x y L L L L L L L L L L L L L L L L L L L L L ++++++∴++++()=-=-210011 0010 1010 1101 0001 0100 1011()()()()()91011910112221231x 301x 301x 3023x 23222222x 123222222x 567x y 1a f a x b f b x c f c x r1f x r f x f x 1f f f L L L L L L L L L L L L L L L ⎡⎤++=⎣⎦⎧++++⎪⎨++++⎪⎩222220220220(-)+(-)+(-) =(+)同理求解:=-+=-+=+2四、直接线性变化的计算过程0011 0010 1010 1101 0001 0100 1011•矩阵L有12个未知系数21•需要已知6个空间待测点的坐标和6对立体像对,即12个像点坐标,才能求解L系数210011 0010 1010 1101 0001 0100 1011[][]xi yi 91011xi i 1i 2i 34i i 9i i 10i i 11i i yi i 5i 6i 78i i 9i i 10i i 11i i 6v v 11v x x x x 1v y y y y L A L X L Y L Z X L Y L Z L L X L Y L Z L A X L Y L Z L L X L Y L Z L A =++⎧++++++⎪⎪⎨⎪++++++⎪⎩第一步:解算系数设在大地坐标系上有个待测点,对应6对立体像对则共有12个关于L的方程,为像点坐标的修正系数令+误差方程:=-+=-+令修正矩阵为:i xiyixiyi xiyi v v v v v v T⎡⎤⎣⎦V =21 0011 0010 1010 1101 0001 0100 1011111111111111111111111111111111116666666666661666666666666666666610000x x x 00001y y y10000x x x 00001y y yBX A Y A Z A A X A Y A Z AX A Y A Z A A X A Y A Z AX A Y A Z A A X A Y A Z AX A Y A Z A A X A Y A Z A ------⎡⎢-----⎢⎢⎢⎢------------⎣=1112610611xyyxLLLLL⎤⎥⎥⎥⎥⎥⎢⎥⎢⎥⎢⎥⎦⎡⎤⎡⎤⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥=⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎣⎦⎣⎦1166-A-AI=-A-A210011 0010 1010 1101 0001 0100 1011121121111112111121210111212111111112121TTTV B L I BVBB L BI =+⨯⨯⨯⨯=⨯⨯+=⨯⨯⨯⨯⨯210011 0010 1010 1101 0001 0100 1011i i x y x y x y x y 2x y x y v v v v v v v v L L V '''''⎡⎤⎢⎥⎡⎤⎢⎥⎢⎥=⎢⎥⎢⎥'⎢⎥⎢⎥⎣⎦⎢⎥'⎢⎥⎣⎦第二步:已知系数,由像点坐标解算物点坐标求解空间物点的坐标为:(X,Y,Z)像机1的L系数为L ,像机的系数为L 立体像对的像点坐标分别为(,)和(,)误差修正系数分别为,和,X 令 S=Y Z210011 0010 1010 1101 0001 0100 101119210311591107111921031159610711(x )(x )(x )(y )(y )(y )(x )(x )(x )(y )(y )(y )L L L L L L L L L L L L N L L L L L L L L L L L L N S ⎡⎤+++⎢⎥⎢⎥⎢⎥+++⎢⎥=⎢⎥''''''⎢⎥'''+++'''⎢⎥⎢⎥''''''''+++⎢⎥⎢⎥'''⎣⎦=+111---A A A111---A A A 111---A A A 111---A A A 矩阵方程为:V 41433141TTQ N NS N Q ⨯⨯⨯⨯+=210011 0010 1010 1101 0001 0100 1011五、关于A值的问题9101133103310333333s 3s 3s3333s 3s 3s 1a rb rc r a X+b Y+c 1a X +b Y +c a X+b Y+c 1a X +b Y +c 1A A L X L Y L Z L L ZA Z ZZ A =+++∴===∴≈ 9值的表达式为:L =-+在实际测量中在机算中210011 0010 1010 1101 0001 0100 1011七、外方位元素的解算()[][][]()[]()[][][]()()()()9101191011910119101191011333333391011122221231x 301x 301x 303312333303030111222222222x222221a b c r 1a b c 2a f a x b f b x c f c x r 1a b c a x b x c x f 3a b c L L L L L L L L L L L L L L L L L L L L L L L L ∴⇒++⎡⎤⎢⎥⇒⎢⎥⎢⎥++++++⎣⎦、外方位角元素的解算11==1又=---=+++同理可求[]()()()()()()()9101191011910115672303030111222222222y 222i i i 1a y b y c y f 123a b c i 123L L L L L L L L L L L L φωκ⎡⎤⎢⎥⎢⎥⎢⎥++++++⎣⎦⇒=+++由、、求方向余弦,,=,,求外方位角元素,如、、。
近景摄影测量实习报告班级: 07021班学号: 0062姓名:方毅日期: 2010年12月1日第一部分摄影、像点量测以及DLT 和单像后方空间交会解算1. 实习的目的和意义数码相机摄影:为后续的摄影测量解析处理提供质量合格的数字影像,了解所用数码相机的特点及使用,学习获取数字影像的方法。
像点量测:量测所拍摄的高精度室内三维控制场中控制点的像点坐标,为后续摄影测量解析处理准备计算数据。
直接线性变换(DLT )与单像空间后方交会解算:加深理解近景摄影测量直接线性变换与单像空间后方交会的理论,学习准备数据和调试程序的方法。
2.实习原理 DLT 直接线性变换直接线性变换解法是建立像点坐标仪坐标和相应物点物方空间坐标直接的线性关系的算法。
它的基本关系式如下:1234910115678910110101l X l Y l Z l x l X l Y l Z l X l Y l Z l y l X l Y l Z +++⎧+=⎪+++⎪⎨+++⎪+=⎪+++⎩()展开可得到以i l 为未知数的方程:1234910115678910110000000000l X l Y l Z l xl X xl Y xl Z x l X l Y l Z l yl X yl Y yl Z y +++++++++++=⎧⎨+++++++++++=⎩() 当有n 个控制点时,即可列出2n 个方程式,写为矩阵的形式如下:111111111111111111111211100000000110000001n n n n n n n n n n n nnn nn nn n n X Y Z x X x Y x Z x l X Y Z y X y Y y Z y l X Y Z x X x Y x Z x l X Y Z y X y Y y Z y -⎡⎤⎡⎤⎡⎤⎢⎥⎢⎥-⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥⎢⎥=⎢⎥⎢⎥⎢⎥-⎢⎥⎢⎥⎢⎥⎣⎦⎢⎥⎢⎥-⎣⎦⎣⎦() 即AX L =。
2.3直接线性变换解法直接线性变换 (Direct Linear Transformation)解法是建立像点坐标仪坐标和相应物点物方空间坐标之间直接的线性关系的算法。
这里,坐标仪坐标是指坐标仪上坐标的直接读数,是指无需化算到以像主点为原点的坐标仪上的坐标读数。
直接线性变换解法,因无需内方位元素值和外方位元素的初始近似值,故特别适用于非量测相机所摄影像的摄影测量处理。
直接线性变换解法具有两个显著的特点:一是由像空间坐标直接变换到物空间坐标,因此不需要任何内、外方位元素的初值;二是直接使用原始的影像坐标作为观测值,因此可以进行有效的系统误差的补偿。
2.3.1直接线性变换解法的基本关系式直接线性变换解法于1971年提出,现将几何概念清晰且便于深入分析的一种方法介绍如下。
直接线性变换(DLT)解法,原则上也是从共线条件方程式演绎而来的。
按共线 条件方程式:()()()()()()()()()()()()S A S A S A S A S A S A S A S A S A S A S A S A Z Z c Y Y b X X a Z Z c Y Y b X X a f y y y Z Z c Y Y b X X a Z Z c Y Y b X X a fx x x -+-+--+-+--=∆+--+-+--+-+--=∆+-33322203331110 把非量测相机所摄像片安置在某坐标仪上,如图2.1所示,假设上式中的系统误差改正数(,x y ∆∆)暂时仅包含坐标轴不垂直性误差d β和比例尺不一误差ds 引起的线性误差改正数部分。
坐标仪坐标系c xy -是非直角坐标系,其两坐标轴之间的不垂直度为d β。
以像主点o 为原点有两个坐标系,分别是直角坐标系o xy -和非直角坐标系o xy -。
像主点o 在c xy -内的坐标为(00,x y )。
某像点'p 的坐标仪坐标为(,x y ),点'p 在非直角坐标系o xy -中的坐标为(21,'om om ),此坐标受d β和ds 的影响而包含线性误差。
DLT 直接线性变换解法程序介绍一、程序综合介绍:DLT结算程序程序功能介绍:应用6个已知点计算左右片l 系数;然后应用已经求得的l系数求解物方空间坐标系坐标程序名:SuYGDLT程序界面:程序界面有四个按钮,分别为读取文件,左片l系数计算,右片系数计算,物放坐标解算程序界面有四个编辑框,分别用来输出文件信息,左片l系数、右片l系数、以及无妨坐标结果截图如下程序使用介绍:必须先点击导入文件按钮,导入文件方可进行正确的计算,如果未导入文件就点击左片平差或右片平差或无妨坐标解算就会弹出如下对话框:读取数据后点击其它按钮进行其它计算。
程序文件格式:数据文件分为两部分,KnownPoint,UNKnownPoint,分别代表已知点信息和待求点信息当文件读取程序读到“KnownPoint”时开始读取已知点信息,已知点信息格式如下GCP1,1214.0000,1032.0000,1046.5180,1071.6652,9.201742,-9.672384,-2.726064分别代表点名、左片相片X坐标、左片相片y坐标、右片相片x坐标、右片相片y坐标物方坐标X、Y、Z;当文件读取到“END KnownPoint”时结束已知坐标的读取待求点信息类似:文件格式截图如下:程序运行结果与评估:本程序区1-10号点作为已知点计算l近似值11-20号点作为未知点解求其物方三维坐标;程序运行结果与所给参考值相似,应该可以证明其运算是正确的,运行结果截图如下:二、程序编程思想及相关代码程序编程思想及相关函数:本程序设计DLTCalculation类作为l系数结算主程序,其成员变量及成员函数与作用介绍如下:CSuLMatrix LL;//左片L系数矩阵CSuLMatrix RL;//右片L系数矩阵int m_iKnownPointCount;//已知点个数CControlPoint *m_pKnownPoint;//已知点int m_iUnKnownPointCount;//未知点个数CControlPoint *m_pUnKnownPoint;//未知点public:CString LoadData(const CString& strFileName);//读取文件函数int ifLoda;//判断是否导入数据CString Datainfor;//文件信息存储CString *SplitString(CString str,char split, int& iSubStrs); //分割函数void LFormApproL(CSuLMatrix &LL);//计算左片L系数近似值void RFormApproL(CSuLMatrix &RL);//计算右片L系数近似值void FormLErrorEquations(CSuLMatrix LL,CMatrix &LM,CMatrix &LW);//组成左片系数矩阵和常数项矩阵void LAdjust();//左片平差主函数void FormRErrorEquations(CSuLMatrix RL,CMatrix &RM,CMatrix &RW);//组成右片系数矩阵和常数项矩阵void RAdjust();//右片平差主函数void Output(const CString& strFileName);//输出结果主程序void OutMatrixToFile(const CMatrix& mat,CStdioFile& SF);//输出矩阵总程序另外设计类qianfangjiaohui作为结算物放坐标解算主程序其成员变量与成员函数及其作用介绍如下:void FormApproCoor( DLTCalculation &R);//计算无妨坐标近似值void FormErrorEquations(DLTCalculation &R,CMatrix &N,CMatrix &Q);//解求系数矩阵void Adjust(DLTCalculation &R);//平差计算物放坐标程序详细代码粘贴如下:以下为类DLTCalculation.cpp文件详细内容:#include"StdAfx.h"#include"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; //分割符的总数CString strTemp = str;CString strRight;//先计算子字符串的数量while (iPos != -1){iPos = strTemp.Find(split);if (iPos == -1){break;}strRight = strTemp.Mid(iPos + 1, str.GetLength());strTemp = strRight;iNums++;}if (iNums == 0) //没有找到分割符{//子字符串数就是字符串本身iSubStrs = 1;return NULL;}//子字符串数组iSubStrs = iNums + 1; //子串的数量= 分割符数量+ 1CString* pStrSplit;pStrSplit = new CString[iSubStrs];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;pStrSplit[i] = strLeft;}pStrSplit[iNums] = strTemp;return pStrSplit;}CString DLTCalculation::LoadData(const CString& strFileName){ifLoda=1;CString strputdata;//用于保存观测文件的字符串CStdioFile sf;//创建文件对象setlocale(LC_ALL,""); //设置语言环境if(!sf.Open(strFileName, CFile::modeRead)) return _T("文件打开失败");;//以读的形式打来文件,如果打开失败则返回CString strLine;int n;CString *strTmp=NULL;do{sf.ReadString (strLine);strputdata+=strLine;strputdata+=_T("\r\n");}while(strLine!="KnownPoint");Datainfor=strputdata;if(strLine=="KnownPoint")//读取已知数据while(strLine!=_T("END KnownPoint")){sf.ReadString (strLine);strputdata+=strLine;strputdata+=_T("\r\n");if(strLine!=_T("END KnownPoint")){strTmp = SplitString(strLine, ',',n);}elsebreak;if(strTmp[0]=="KnownPointCount"){m_iKnownPointCount=_ttoi(strTmp[1]);m_pKnownPoint=new CControlPoint[m_iKnownPointCount];if(strTmp!=NULL)//释放内存{delete[] strTmp;strTmp=NULL;}for(int i=0;i<m_iKnownPointCount;i++){sf.ReadString (strLine);strputdata+=strLine;strputdata+=_T("\r\n");strTmp = SplitString(strLine, ',',n);m_pKnownPoint[i].strName =strTmp[0];m_pKnownPoint[i].Lx =_tstof(strTmp[1]);m_pKnownPoint[i].Ly =_tstof(strTmp[2]);m_pKnownPoint[i].Rx =_tstof(strTmp[3]);m_pKnownPoint[i].Ry =_tstof(strTmp[4]);m_pKnownPoint[i].X =_tstof(strTmp[5]);m_pKnownPoint[i].Y =_tstof(strTmp[6]);m_pKnownPoint[i].Z =_tstof(strTmp[7]);if(strTmp!=NULL)//释放内存{delete[] strTmp;strTmp=NULL;}}}}sf.ReadString (strLine);strputdata+=strLine;strputdata+=_T("\r\n");if(strLine=="UnknownPoint")//读取未知数据{while(strLine!=_T("END UnknownPoint")){sf.ReadString (strLine);strputdata+=strLine;strputdata+=_T("\r\n");if(strLine!=_T("END UnknownPoint")){strTmp = SplitString(strLine, ',',n);}elsebreak;if(strTmp[0]=="UnknownPointCount"){m_iUnKnownPointCount=_ttoi(strTmp[1]);m_pUnKnownPoint=new CControlPoint[m_iUnKnownPointCount];if(strTmp!=NULL)//释放内存{delete[] strTmp;strTmp=NULL;}for(int i=0;i<m_iUnKnownPointCount;i++){sf.ReadString (strLine);strputdata+=strLine;strputdata+=_T("\r\n");strTmp = SplitString(strLine, ',',n);m_pUnKnownPoint[i].strName =strTmp[0];m_pUnKnownPoint[i].Lx =_tstof(strTmp[1]);m_pUnKnownPoint[i].Ly =_tstof(strTmp[2]);m_pUnKnownPoint[i].Rx =_tstof(strTmp[3]);m_pUnKnownPoint[i].Ry =_tstof(strTmp[4]);if(strTmp!=NULL)//释放内存{delete[] strTmp;strTmp=NULL;}}}}}sf.Close ();return strputdata;}void DLTCalculation::LFormApproL(CSuLMatrix &LL)//计算左片L系数近似值{CMatrix LX(11,1);CMatrix LB(11,11);CMatrix Lf(11,1);for(int i=0;i<5;i++){LB(2*i,0) = LB(2*i+1,4) = m_pKnownPoint[i].X*1000;LB(2*i,1) = LB(2*i+1,5) = m_pKnownPoint[i].Y*1000;LB(2*i,2) = LB(2*i+1,6) = m_pKnownPoint[i].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*i,8) = m_pKnownPoint[i].Lx * m_pKnownPoint[i].X*1000;LB(2*i,9) = m_pKnownPoint[i].Lx * m_pKnownPoint[i].Y*1000;LB(2*i,10) = m_pKnownPoint[i].Lx * m_pKnownPoint[i].Z*1000;LB(2*i+1,8) = m_pKnownPoint[i].Ly * m_pKnownPoint[i].X*1000;LB(2*i+1,9) = m_pKnownPoint[i].Ly * m_pKnownPoint[i].Y*1000;LB(2*i+1,10) = m_pKnownPoint[i].Ly * m_pKnownPoint[i].Z*1000;}LB(10,0) = m_pKnownPoint[5].X*1000;LB(10,1) = m_pKnownPoint[5].Y*1000;LB(10,2) = m_pKnownPoint[5].Z*1000;LB(10,3) = 1;LB(10,4) = LB(10,5) = LB(10,6) = LB(10,7) = 0;LB(10,8) = m_pKnownPoint[5].Lx * m_pKnownPoint[5].X*1000;LB(10,9) = m_pKnownPoint[5].Lx * m_pKnownPoint[5].Y*1000;LB(10,10) = m_pKnownPoint[5].Lx * m_pKnownPoint[5].Z*1000;for(int i=0;i<5;i++){Lf(2*i,0) = m_pKnownPoint[i].Lx;Lf(2*i+1,0) = m_pKnownPoint[i].Ly;}Lf(10,0) = m_pKnownPoint[5].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 = LX(7,0);LL.l9 = LX(8,0);LL.l10 = LX(9,0);LL.l11 = LX(10,0);}void DLTCalculation::RFormApproL(CSuLMatrix &RL)//计算右片L系数近似值{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_pKnownPoint[i].X*1000;RB(2*i,1) = RB(2*i+1,5) = m_pKnownPoint[i].Y*1000;RB(2*i,2) = RB(2*i+1,6) = m_pKnownPoint[i].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_pKnownPoint[i].Rx * m_pKnownPoint[i].X*1000;RB(2*i,9) = m_pKnownPoint[i].Rx * m_pKnownPoint[i].Y*1000;RB(2*i,10) = m_pKnownPoint[i].Rx * m_pKnownPoint[i].Z*1000;RB(2*i+1,8) = m_pKnownPoint[i].Ry * m_pKnownPoint[i].X*1000;RB(2*i+1,9) = m_pKnownPoint[i].Ry * m_pKnownPoint[i].Y*1000;RB(2*i+1,10) = m_pKnownPoint[i].Ry * m_pKnownPoint[i].Z*1000;}RB(10,0) = m_pKnownPoint[5].X*1000;RB(10,1) = m_pKnownPoint[5].Y*1000;RB(10,2) = m_pKnownPoint[5].Z*1000;RB(10,3) = 1;RB(10,4) = RB(10,5) = RB(10,6) = RB(10,7) = 0;RB(10,8) = m_pKnownPoint[5].Rx * m_pKnownPoint[5].X*1000;RB(10,9) = m_pKnownPoint[5].Rx * m_pKnownPoint[5].Y*1000;RB(10,10) = m_pKnownPoint[5].Rx * m_pKnownPoint[5].Z*1000;for(int i=0;i<5;i++){Rf(2*i,0) = m_pKnownPoint[i].Rx;Rf(2*i+1,0) = m_pKnownPoint[i].Ry;}Rf(10,0) = m_pKnownPoint[5].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(CSuLMatrix LL,CMatrix &LM,CMatrix &LW)//组成左片系数矩阵和常数项矩阵{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_pKnownPoint[i].X * 1000 + LL.l10 * m_pKnownPoint[i].Y * 1000 + LL.l1 *m_pKnownPoint[i].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_pKnownPoint[i].Lx-x0)*(m_pKnownPoint[i].Lx-x0) +(m_pKnownPoint[i].Ly-y0)*(m_pKnownPoint[i].Ly-y0));LM(2*i,0) = LM(2*i+1,4) = (-1)*m_pKnownPoint[i].X * 1000 /A;LM(2*i,1) = LM(2*i+1,5) = (-1)*m_pKnownPoint[i].Y * 1000 /A;LM(2*i,2) = LM(2*i+1,6) = (-1)*m_pKnownPoint[i].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*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_pKnownPoint[i].Lx * m_pKnownPoint[i].X* 1000 /A;LM(2*i,9) = (-1)*m_pKnownPoint[i].Lx * m_pKnownPoint[i].Y* 1000 /A;LM(2*i,10) = (-1)*m_pKnownPoint[i].Lx * m_pKnownPoint[i].Z* 1000 /A;LM(2*i,11) = (-1)*(m_pKnownPoint[i].Lx - x0) * r * r;LM(2*i+1,8) = (-1)*m_pKnownPoint[i].Ly * m_pKnownPoint[i].X* 1000 /A;LM(2*i+1,9) = (-1)*m_pKnownPoint[i].Ly * m_pKnownPoint[i].Y* 1000 /A;LM(2*i+1,10) = (-1)*m_pKnownPoint[i].Ly * m_pKnownPoint[i].Z* 1000 /A;LM(2*i+1,11) = (-1)*(m_pKnownPoint[i].Ly - y0) * r * r;LW(2*i,0) = (-1)*m_pKnownPoint[i].Lx/A;LW(2*i+1,0) = (-1)*m_pKnownPoint[i].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+_T("\r\n"));}}void DLTCalculation::LAdjust()//左片平差主函数{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;double 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)/(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*B0-C0*C0)/B0);/*do{FormLErrorEquations(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.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);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.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 DLTCalculation::Output(const CString& strFileName){CStdioFile SF;CString strLine;setlocale(LC_ALL,"");if(!SF.Open(strFileName, CFile::modeCreate|CFile::modeWrite)) return;//开始写数据SF.WriteString(_T("结果输出:\n"));SF.WriteString(_T("---------空间后方交汇----------\n"));CMatrix LM(2*m_iKnownPointCount,12);CMatrix LW(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 * 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 * 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=LNbb.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.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.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("%s\r\n"),_T("左片结果"));strputdata+=putdata;putdata.Format(_T("%s\r\n"),_T("L系数为:"));strputdata+=putdata;putdata.Format(_T("%s%.5f\r\n%s%.5f\r\n%s%.5f\r\n%s%.5f\r\n%s%.5f\r\n%s%.5f\r\n%s%.5f\r\n%s%.5f\r \n%s%.5f\r\n%s%.5f\r\n%s%.5f\r\n"),_T("l1 = "),LL.l1,_T("l2 = "),LL.l2,_T("l3 = "),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(_T("%s%d\r\n"),_T("迭代次数为:"),Ln);///*strputdata+=putdata;*/}void DLTCalculation::RAdjust()//右片平差主函数{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;double 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);//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 + 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,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.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);*///}类qianfangjiaohui 的cpp文件代码粘贴如下:#include"StdAfx.h"#include"qianfangjiaohui.h"qianfangjiaohui::qianfangjiaohui(void){}qianfangjiaohui::~qianfangjiaohui(void){}void qianfangjiaohui::FormApproCoor(DLTCalculation &R){CMatrix A(3,3);CMatrix f(3,1);CMatrix X(3,1);for(int i=0;i<R.m_iUnKnownPointCount;i++){A(0,0) = R.LL.l1 + R.m_pUnKnownPoint[i].Lx * R.LL.l9;A(0,1) = R.LL.l2 + R.m_pUnKnownPoint[i].Lx * R.LL.l10;A(0,2) = R.LL.l3 + R.m_pUnKnownPoint[i].Lx * R.LL.l11;A(1,0) = R.LL.l5 + R.m_pUnKnownPoint[i].Ly * R.LL.l9;A(1,1) = R.LL.l6 + R.m_pUnKnownPoint[i].Ly * R.LL.l10;A(1,2) = R.LL.l7 + R.m_pUnKnownPoint[i].Ly * R.LL.l11;A(2,0) = R.RL.l1 + R.m_pUnKnownPoint[i].Rx * R.RL.l9;A(2,1) = R.RL.l2 + R.m_pUnKnownPoint[i].Rx * R.RL.l10;A(2,2) = R.RL.l3 + R.m_pUnKnownPoint[i].Rx * R.RL.l11;f(0,0) = R.LL.l4 + R.m_pUnKnownPoint[i].Lx;f(1,0) = R.LL.l8 + R.m_pUnKnownPoint[i].Ly;f(2,0) = R.RL.l4 + R.m_pUnKnownPoint[i].Rx;X = (-1)*(A.Inv())*f;R.m_pUnKnownPoint[i].X = X(0,0)/1000;R.m_pUnKnownPoint[i].Y = X(1,0)/1000;R.m_pUnKnownPoint[i].Z = X(2,0)/1000;}}void qianfangjiaohui::FormErrorEquations(DLTCalculation &R,CMatrix &N,CMatrix &Q){N.SetSize(4,3);Q.SetSize(4,1);double LA,RA;for(int i=0;i<R.m_iUnKnownPointCount;i++){LA=R.LL.l9*R.m_pUnKnownPoint[i].X+R.LL.l10*R.m_pUnKnownPoint[i].Y+R.LL.l11*R.m_pUnKnown Point[i].Z+1;RA=R.RL.l9*R.m_pUnKnownPoint[i].X+R.RL.l10*R.m_pUnKnownPoint[i].Y+R.RL.l11*R.m_pUnKnow nPoint[i].Z+1;N(0,0) = (-1) * (R.LL.l1 + R.LL.l9 * R.m_pUnKnownPoint[i].Lx) / LA;N(0,1) = (-1) * (R.LL.l2 + R.LL.l10 * R.m_pUnKnownPoint[i].Lx) / LA;N(0,2) = (-1) * (R.LL.l3 + R.LL.l11 * R.m_pUnKnownPoint[i].Lx) / LA;N(1,0) = (-1) * (R.LL.l5 + R.LL.l9 * R.m_pUnKnownPoint[i].Ly) / LA;N(1,1) = (-1) * (R.LL.l6 + R.LL.l10 * R.m_pUnKnownPoint[i].Ly) / LA;N(1,2) = (-1) * (R.LL.l7 + R.LL.l11 * R.m_pUnKnownPoint[i].Ly) / LA;N(2,0) = (-1) * (R.RL.l1 + R.RL.l9 * R.m_pUnKnownPoint[i].Rx) / RA;N(2,1) = (-1) * (R.RL.l2 + R.RL.l10 * R.m_pUnKnownPoint[i].Rx) / RA;N(2,2) = (-1) * (R.RL.l3 + R.RL.l11 * R.m_pUnKnownPoint[i].Rx) / RA;N(3,0) = (-1) * (R.RL.l5 + R.RL.l9 * R.m_pUnKnownPoint[i].Ry) / RA;N(3,1) = (-1) * (R.RL.l6 + R.RL.l10 * R.m_pUnKnownPoint[i].Ry) / RA;N(3,2) = (-1) * (R.RL.l7 + R.RL.l11 * R.m_pUnKnownPoint[i].Ry) / RA;Q(0,0) = (-1) * (R.LL.l4 + R.m_pUnKnownPoint[i].Lx);Q(1,0) = (-1) * (R.LL.l8 + R.m_pUnKnownPoint[i].Ly);Q(2,0) = (-1) * (R.RL.l4 + R.m_pUnKnownPoint[i].Rx);Q(3,0) = (-1) * (R.RL.l8 + R.m_pUnKnownPoint[i].Ry);}}void qianfangjiaohui::Adjust(DLTCalculation &R){double d1,d2,d3;double m;CMatrix N(4,3);CMatrix Q(4,1);CMatrix Nbb(3,3);CMatrix Nvv(3,1);CMatrix S(3,1);int n=0;FormApproCoor(R);for(int i=0;i<R.m_iUnKnownPointCount;i++){/* do*/{/*FormErrorEquations(R,N,Q);Nbb=(~N)*N;Nvv=(~N)*Q;S=(-1)*(Nbb.Inv())*Nvv;m=S(0,0);d1=S(0,0)-R.m_pUnKnownPoint[i].X;d2=S(1,0)-R.m_pUnKnownPoint[i].Y;d3=S(2,0)-R.m_pUnKnownPoint[i].Z;R.m_pUnKnownPoint[i].X=S(0,0);R.m_pUnKnownPoint[i].Y=S(1,0);R.m_pUnKnownPoint[i].Z=S(2,0);n++;*/}/*while(fabs(d1)>1||fabs(d2)>1||fabs(d3)>1);*/}}实验所需txt 文件粘贴如下:SuYongGang 010*******2015 05 01KnownPointKnownPointCount,10GCP1,1214.0000,1032.0000,1046.5180,1071.6652,9.201742,-9.672384,-2.726064 GCP2,1378.0000,508.0000,1167.8218,541.4734,8.653967,-8.226455,-5.483531 GCP3,605.0000,1527.0000,391.3034,1573.4119,6.175121,-11.003152,0.227490 GCP4,1468.0000,361.0000,1262.5994,388.2626,9.004163,-7.857839,-6.448011 GCP5,940.0000,1264.0000,719.0428,1310.4186,7.206690,-9.863228,-1.122442 GCP6,1204.0000,563.0000,990.1780,606.6536,7.986264,-8.928340,-5.054990 GCP7,554.0000,1158.0000,348.4338,1217.2070,5.888988,-11.267342,-1.584110 GCP8,1972.0000,1455.0000,1781.7030,1481.7072,10.951923,-5.749235,-0.276650 GCP9,1013.0000,739.0000,797.4695,790.9252,7.321597,-9.658292,-3.954598 GCP10,2814.0000,1057.0000,2745.6122,1035.4548,14.760180,-1.714839,-2.804178 END KnownPointUnknownPointUnknownPointCount,10ID,Lx,Ly,Lz,Rx,Ry,Rz1,1411.0000,319.0000,1209.0579,350.27772,1495.0000,297.0000,1296.0357,322.26193,1348.0000,475.0000,1140.2866,510.61094,2500.0000,717.0000,2380.9077,688.05625,342.0000,442.0000,165.1718,540.67196,2217.0000,954.0000,2059.9866,951.8440 7,1356.0000,578.0000,1147.8519,612.7434 8,1398.0000,574.0000,1190.8740,606.4662 9,1234.0000,1032.0000,1066.8420,1070.8535 10,1481.0000,577.0000, 1276.1857,604.2876 END UnknownPoint。