資源簡介
包含DLT算子全過程 生成的文本路徑需自己設定

代碼片段和文件信息
#include?“StdAfx.h“
#include?
#include?“DLTlinesTrans.h“
#include?“MyMatrix.h“
#include?
DLTlinesTrans::DLTlinesTrans(void)
{
}
DLTlinesTrans::~DLTlinesTrans(void)
{
}
int?DLTlinesTrans::GetLinesNum(char?*filenameint?&m)
{
FILE?*file;
file=fopen(filename“rt+“);
int?temp=1;
char?ch=fgetc(file);
while?(ch!=EOF)
{
if?(ch==‘\n‘)
{temp++;
}
ch=fgetc(file);
}
fclose(file);
m=temp;
return?m;
}
void?DLTlinesTrans::InputDate(char?*filenameint?n?INPUT?*inputdate)
{
FILE?*file;
file=fopen(filename“rt“);
for?(int?i=0;i {fscanf(file“%f%f%f%f%f“&inputdate[i].x&inputdate[i].y&inputdate[i].X&inputdate[i].Y&inputdate[i].Z);
}
fclose(file);
}
void?DLTlinesTrans::saveL(char?*filenamefloat?*a)
{
FILE?*file;
file=fopen(filename“wt+“);
for?(int?i=0;i {
fprintf(file“L%d=%f\n“i+1a[i]);
}
fclose(file);
}
void?DLTlinesTrans::TotalProcess(char?*filenamefloat?*L)
{
int?linenumber;???????????//文本文件里的行數也就是其點數,每個控制點在文本文件里占一行
GetLinesNum(filenamelinenumber);????//獲得控制點數目
INPUT?*origndata=new?INPUT[linenumber];???//聲明原始數據的數組來存儲數據
InputDate(filenamelinenumberorigndata);?????????//調用DLTlinesTrans類里面的函數來初始化數組
showdata(origndatalinenumber);???????//在控制臺里面顯示原始數據
float?*Cxishu=new?float[22*linenumber]; //C系數矩陣聲明
InialCxishu(origndatalinenumberCxishu); //初始化該矩陣
float?*Dxishu=new?float[2*linenumber]; //D常數矩陣
InialDxishu(origndatalinenumberDxishu); //初始化常數矩陣
showCxishu(Cxishulinenumber); //分別顯示C和D矩陣
showDxishu(Dxishulinenumber);
float?*CTxishu=new?float[22*linenumber]; //聲明轉置矩陣
MyMatrix::CalculateAT(CxishuCTxishu2*linenumber11); //對C矩陣進行轉置
float?*CTCxishu=new?float[121];
MyMatrix::CalculateAB(CTxishuCxishuCTCxishu112*linenumber11); //CT與C矩陣相乘
showCTCxishu(CTCxishu); //顯示CTC矩陣
float?*CTDxishu=new?float[11];?????
MyMatrix::CalculateAB(CTxishuDxishuCTDxishu112*linenumber1); //CT與D矩陣相乘
float?*CTCxishu_NI=new?float[121]; //對CTC矩陣求逆
CTCxishu_NI=CTCxishu;
MyMatrix::rinv(CTCxishu_NIN);
//float?*L=new?float[11]; //L=(CTC)-1*(CTD)
MyMatrix::CalculateAB(CTCxishu_NICTDxishuL11111);
for(int?m=0;m<11;m++)
{
L[m]=L[m]*(-1);
}
}
void?DLTlinesTrans::showdata(INPUT?*dataint?n)
{
printf(“控制點坐標為:\n“);
printf(“數目n為%d\n“n);
printf(“x y X Y Z\n“);
for?(int?i=0;i {
printf(“%f %f %f %f %f\n“data[i].xdata[i].ydata[i].Xdata[i].Ydata[i].Z);
}
printf(“\n*****************************************************************************\n“);
}
/////////////////////////////////////////////////////////////////////////////////
/*初始化常數項c////////////////////*/
//////////////////////////////////////////////////////////////////////////////////
void?DLTlinesTrans::InialCxishu(INPUT?*data1int?nfloat?*data2)
{
for?(int?i=0;i {
data2[i*22]=data1[i].X;
data2[i*22+1]=data1[i].Y;
data2[i*22+2]=data1[i]
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????57344??2014-04-09?21:17??DLTTRANS\Debug\DLTTRANS.exe
?????文件?????378556??2014-04-09?21:17??DLTTRANS\Debug\DLTTRANS.ilk
?????文件?????560128??2014-04-09?21:17??DLTTRANS\Debug\DLTTRANS.pdb
?????文件???????2862??2014-04-09?21:17??DLTTRANS\DLTTRANS\Debug\cl.command.1.tlog
?????文件???????4554??2014-04-09?21:17??DLTTRANS\DLTTRANS\Debug\CL.read.1.tlog
?????文件???????2486??2014-04-09?21:17??DLTTRANS\DLTTRANS\Debug\CL.write.1.tlog
?????文件??????53267??2014-04-09?21:17??DLTTRANS\DLTTRANS\Debug\DLTlinesTrans.obj
?????文件????????406??2014-03-29?16:30??DLTTRANS\DLTTRANS\Debug\DLTTRANS.exe.em
?????文件????????472??2014-03-29?16:30??DLTTRANS\DLTTRANS\Debug\DLTTRANS.exe.em
?????文件????????381??2014-04-09?21:17??DLTTRANS\DLTTRANS\Debug\DLTTRANS.exe.intermediate.manifest
?????文件?????????52??2014-04-09?21:17??DLTTRANS\DLTTRANS\Debug\DLTTRANS.lastbuildstate
?????文件???????7840??2014-04-09?21:17??DLTTRANS\DLTTRANS\Debug\DLTTRANS.log
?????文件???????9628??2014-04-09?21:17??DLTTRANS\DLTTRANS\Debug\DLTTRANS.obj
?????文件????1179648??2014-03-29?16:29??DLTTRANS\DLTTRANS\Debug\DLTTRANS.pch
?????文件????????206??2014-03-29?16:30??DLTTRANS\DLTTRANS\Debug\DLTTRANS_manifest.rc
?????文件??????????2??2014-04-09?21:17??DLTTRANS\DLTTRANS\Debug\li
?????文件??????????2??2014-04-09?21:17??DLTTRANS\DLTTRANS\Debug\li
?????文件??????????2??2014-04-09?21:17??DLTTRANS\DLTTRANS\Debug\li
?????文件??????????2??2014-04-09?21:17??DLTTRANS\DLTTRANS\Debug\li
?????文件??????????2??2014-04-09?21:17??DLTTRANS\DLTTRANS\Debug\li
?????文件??????????2??2014-04-09?21:17??DLTTRANS\DLTTRANS\Debug\li
?????文件??????????2??2014-04-09?21:17??DLTTRANS\DLTTRANS\Debug\li
?????文件??????????2??2014-04-09?21:17??DLTTRANS\DLTTRANS\Debug\li
?????文件??????????2??2014-04-09?21:17??DLTTRANS\DLTTRANS\Debug\li
?????文件??????????2??2014-04-09?21:17??DLTTRANS\DLTTRANS\Debug\li
?????文件??????????2??2014-04-09?21:17??DLTTRANS\DLTTRANS\Debug\li
?????文件??????????2??2014-04-09?21:17??DLTTRANS\DLTTRANS\Debug\li
?????文件??????????2??2014-04-09?21:17??DLTTRANS\DLTTRANS\Debug\li
?????文件??????????2??2014-04-09?21:17??DLTTRANS\DLTTRANS\Debug\li
?????文件??????????2??2014-04-09?21:17??DLTTRANS\DLTTRANS\Debug\li
............此處省略49個文件信息
評論
共有 條評論