DLT直接线性变换解法程序Word文件下载.docx

上传人:b****1 文档编号:3914258 上传时间:2023-05-02 格式:DOCX 页数:28 大小:70.13KB
下载 相关 举报
DLT直接线性变换解法程序Word文件下载.docx_第1页
第1页 / 共28页
DLT直接线性变换解法程序Word文件下载.docx_第2页
第2页 / 共28页
DLT直接线性变换解法程序Word文件下载.docx_第3页
第3页 / 共28页
DLT直接线性变换解法程序Word文件下载.docx_第4页
第4页 / 共28页
DLT直接线性变换解法程序Word文件下载.docx_第5页
第5页 / 共28页
DLT直接线性变换解法程序Word文件下载.docx_第6页
第6页 / 共28页
DLT直接线性变换解法程序Word文件下载.docx_第7页
第7页 / 共28页
DLT直接线性变换解法程序Word文件下载.docx_第8页
第8页 / 共28页
DLT直接线性变换解法程序Word文件下载.docx_第9页
第9页 / 共28页
DLT直接线性变换解法程序Word文件下载.docx_第10页
第10页 / 共28页
DLT直接线性变换解法程序Word文件下载.docx_第11页
第11页 / 共28页
DLT直接线性变换解法程序Word文件下载.docx_第12页
第12页 / 共28页
DLT直接线性变换解法程序Word文件下载.docx_第13页
第13页 / 共28页
DLT直接线性变换解法程序Word文件下载.docx_第14页
第14页 / 共28页
DLT直接线性变换解法程序Word文件下载.docx_第15页
第15页 / 共28页
DLT直接线性变换解法程序Word文件下载.docx_第16页
第16页 / 共28页
DLT直接线性变换解法程序Word文件下载.docx_第17页
第17页 / 共28页
DLT直接线性变换解法程序Word文件下载.docx_第18页
第18页 / 共28页
DLT直接线性变换解法程序Word文件下载.docx_第19页
第19页 / 共28页
DLT直接线性变换解法程序Word文件下载.docx_第20页
第20页 / 共28页
亲,该文档总共28页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

DLT直接线性变换解法程序Word文件下载.docx

《DLT直接线性变换解法程序Word文件下载.docx》由会员分享,可在线阅读,更多相关《DLT直接线性变换解法程序Word文件下载.docx(28页珍藏版)》请在冰点文库上搜索。

DLT直接线性变换解法程序Word文件下载.docx

//右片L系数矩阵

intm_iKnownPointCount;

//点个数

CControlPoint*m_pKnownPoint;

//点

intm_iUnKnownPointCount;

//未知点个数

CControlPoint*m_pUnKnownPoint;

//未知点

public:

CStringLoadData(constCString&

strFileName);

//读取文件函数

intifLoda;

//判断是否导入数据

CStringDatainfor;

//文件信息存储

CString*SplitString(CStringstr,charsplit,int&

iSubStrs);

//分割函数

voidLFormApproL(CSuLMatrix&

LL);

//计算左片L系数近似值

voidRFormApproL(CSuLMatrix&

RL);

//计算右片L系数近似值

voidFormLErrorEquations(CSuLMatrixLL,CMatrix&

LM,CMatrix&

LW);

//组成左片系数矩阵和常数项矩阵

voidLAdjust();

//左片平差主函数

voidFormRErrorEquations(CSuLMatrixRL,CMatrix&

RM,CMatrix&

RW);

//组成右片系数矩阵和常数项矩阵

voidRAdjust();

//右片平差主函数

voidOutput(constCString&

//输出结果主程序

voidOutMatrixToFile(constCMatrix&

mat,CStdioFile&

SF);

//输出矩阵总程序

另外设计类qianfangjiaohui作为结算物放坐标解算主程序其成员变量与成员函数与其作用介绍如下:

voidFormApproCoor(DLTCalculation&

R);

//计算无妨坐标近似值

voidFormErrorEquations(DLTCalculation&

R,CMatrix&

N,CMatrix&

Q);

//解求系数矩阵

voidAdjust(DLTCalculation&

//平差计算物放坐标

程序详细代码粘贴如下:

以下为类DLTCalculation.cpp文件详细内容:

#include"

StdAfx.h"

DLTCalculation.h"

#include<

locale>

SuLMatrix.h"

DLTCalculation:

:

DLTCalculation(void)

{

ifLoda=0;

}

~DLTCalculation(void)

CString*DLTCalculation:

SplitString(CStringstr,charsplit,int&

iSubStrs)

intiPos=0;

//分割符位置

intiNums=0;

//分割符的总数

CStringstrTemp=str;

CStringstrRight;

//先计算子字符串的数量

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;

returnNULL;

//子字符串数组

iSubStrs=iNums+1;

//子串的数量=分割符数量+1

CString*pStrSplit;

pStrSplit=newCString[iSubStrs];

strTemp=str;

CStringstrLeft;

for(inti=0;

i<

iNums;

i++)

//左子串

strLeft=strTemp.Left(iPos);

//右子串

strRight=strTemp.Mid(iPos+1,strTemp.GetLength());

pStrSplit[i]=strLeft;

pStrSplit[iNums]=strTemp;

returnpStrSplit;

 

CStringDLTCalculation:

LoadData(constCString&

strFileName)

ifLoda=1;

CStringstrputdata;

//用于保存观测文件的字符串

CStdioFilesf;

//创建文件对象

setlocale(LC_ALL,"

"

);

//设置语言环境

if(!

sf.Open(strFileName,CFile:

modeRead))return_T("

文件打开失败"

;

//以读的形式打来文件,如果打开失败如此返回

CStringstrLine;

intn;

CString*strTmp=NULL;

do

sf.ReadString(strLine);

strputdata+=strLine;

strputdata+=_T("

\r\n"

}while(strLine!

="

KnownPoint"

Datainfor=strputdata;

if(strLine=="

)//读取数据

while(strLine!

=_T("

ENDKnownPoint"

))

if(strLine!

strTmp=SplitString(strLine,'

'

n);

else

if(strTmp[0]=="

KnownPointCount"

m_iKnownPointCount=_ttoi(strTmp[1]);

m_pKnownPoint=newCControlPoint[m_iKnownPointCount];

if(strTmp!

=NULL)//释放内存

delete[]strTmp;

strTmp=NULL;

for(inti=0;

i<

m_iKnownPointCount;

i++)

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]);

UnknownPoint"

)//读取未知数据

{

ENDUnknownPoint"

UnknownPointCount"

m_iUnKnownPointCount=_ttoi(strTmp[1]);

m_pUnKnownPoint=newCControlPoint[m_iUnKnownPointCount];

m_iUnKnownPointCount;

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]);

sf.Close();

returnstrputdata;

voidDLTCalculation:

LFormApproL(CSuLMatrix&

LL)//计算左片L系数近似值

CMatrixLX(11,1);

CMatrixLB(11,11);

CMatrixLf(11,1);

5;

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;

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);

RFormApproL(CSuLMatrix&

RL)//计算右片L系数近似值

CMatrixRX(11,1);

CMatrixRB(11,11);

CMatrixRf(11,1);

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;

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);

FormLErrorEquations(CSuLMatrixLL,CMatrix&

LW)//组成左片系数矩阵和常数项矩阵

LM.SetSize(2*m_iUnKnownPointCount,12);

LW.SetSize(2*m_iUnKnownPointCount,1);

//LFormApproL(LL);

doubleA;

doublex0,y0;

doubler;

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;

OutMatrixToFile(constCMatrix&

mat,C

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 工程科技 > 能源化工

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2