第七章 空间后方交会C++程序代码.docVIP

  • 11
  • 0
  • 约1.1万字
  • 约 15页
  • 2017-07-09 发布于湖北
  • 举报
摄影测量后方交会程序(c/c++) 输入数据截图: 结果截图: 程序源代码(其中的矩阵求逆在前面已经有了,链接): #include stdio.h #include stdlib.h #include math.h const double PRECISION=1e-5; typedef double DOUBLE[5]; int InputData(int Num, DOUBLE *Data,double m,double f); int Resection(const int Num,const DOUBLE *Data,const double m,const double f); int InverseMatrix(double *matrix,const int row); int main(int argc, char* argv[]) { DOUBLE *Data=NULL; int Num; double f(0),m(0); if(InputData(Num,Data,m,f)) { ?? if (Data!=NULL) ?? { ??? delete []Data; ?? } ?? return 1; } if(Resection(Num,Data,m,f)) { ?? if (Data!=NULL) ?? { ??? delete []Data; ?? } ?? return 1; } if (Data!=NULL) { ?? delete []Data; } printf(解算完毕...\n); do{?? ?? printf(计算结果保存于\结果.txt\文件中\n ??? 请选择操作(输入P打开结果数据,R打开原始数据,其它退出程序):); ?? fflush(stdin);?? //刷新输入流 ?? char order=getchar();?? ?? if (P==order || p==order) ?? {?? ??? system(结果.txt); ?? } ?? else if (R==order || r==order) ?? { ??? system(data.txt); ?? } ?? else ??? break; ?? system(cls); }while(1); system(PAUSE); return 0; } /********************************************** *函数名:InputData????? *函数介绍:从文件(data.txt)中读取数据, *文件格式如下: *点数 m(未知写作0) * 内方位元素(f x0 y0) *编号 x y X Y Z *下面是一个实例: 4 0 153.24 0 0 1 -86.15 -68.99 36589.41 25273.32 2195.17 2 -53.40 82.21 37631.08 31324.51 728.69 3 -14.78 -76.63 39100.97 24934.98 2386.50 4 10.46 64.43 40426.54 30319.81 757.31 *参数:(in/out)Num(点数), *(in/out)Data(存放数据),m,f,x0,y0 *返回值:int ,0成功,1文件打开失败,2控制点个 *数不足,3文件格式错误 *作者:vcrs *完成时间:09-10-4 **********************************************/ int InputData(int Num, DOUBLE *Data,double m,double f) { double x0,y0; FILE *fp_input; if (!(fp_input=fopen(data.txt,r))) { ?? return 1; } fscanf(fp_input,%d%lf,Num,m); if (Num4) { ?? return 2; } fscanf(fp_input,%lf%lf%lf,f,x0,y0); f/=1000; if (m0 || f0) { ?? return 3; } Data=new DOUBLE[Num]; double *temp= new double[Num-1]; double scale=0; int i; for (i=0;iNum;i++) { ?? //读取数据,忽略编号 ?? if(fscanf(fp_input,%*d%lf%lf%lf%lf%lf, ??? Data[i][0],Data[i][1],Data[i][2], ??? Data[i][3],Data[i][4])!=5)

文档评论(0)

1亿VIP精品文档

相关文档