您好,欢迎光临本网站![请登录][注册会员]  
文件名称: 空间后方交会_摄影测量
  所属分类: 专业指导
  开发工具:
  文件大小: 6kb
  下载次数: 0
  上传时间: 2011-06-24
  提 供 者: cxz****
 详细说明: #include #include #include #include #include #include "CCMat.h" #include "Point.h" using namespace::std; //坐标: //f,H double f,H,m; int N; //a1-c3 double a1,a2,a3,b1,b2,b3,c1,c2,c3; //XYZ的代号: double Xb,Yb,Zb; //六个外方为元素: double g_Xs,g_Ys,g_Zs; double dXs, dYs, dZs; double g_fai,g_omga,g_kama; double dfai, domga, dkama; //像点坐标的表示: double x,x_estimate; double y,y_estimate; //12个系数: double a00,a01,a02,a03,a04,a05,a10,a11,a12,a13 ,a14,a15; //控制点坐标: vector vpoints; //计算a1-c3 void abc_get() { a1 = cos(g_fai)*cos(g_kama) - sin(g_omga)*sin(g_fai)*sin(g_kama); a2 = -cos(g_fai)*sin(g_kama)-sin(g_omga)*sin(g_fai)*cos(g_kama); a3 = -sin(g_fai)*cos(g_omga); b1 = cos(g_omga)*sin(g_kama); b2 = cos(g_omga)*cos(g_kama); b3 = -sin(g_omga); c1 = sin(g_omga)*cos(g_kama) + cos(g_fai)*sin(g_omga)*sin(g_kama); c2 = -sin(g_omga)*sin(g_kama) + cos(g_fai)*sin(g_omga)*cos(g_kama); c3 = cos(g_omga)*cos(g_fai); } //计算XbYbZb void XbYbZb_get(double X,double Y,double Z) { Xb = a1*(X - g_Xs)+b1*(Y - g_Ys)+c1*(Z - g_Zs); Yb = a2*(X - g_Xs)+b2*(Y - g_Ys)+c2*(Z - g_Zs); Zb = a3*(X - g_Xs)+b3*(Y - g_Ys)+c3*(Z - g_Zs); } //计算像点坐标的近似值: //double x_or_y_get(char flg,double X,double Y,double Z); double x_or_y_get(char flg) { if (flg == 0) return -f*Xb/Zb; else return -f*Yb/Zb; } //计算a00到a15 CCMat a00a15_get(double x,double y) { a00 = (a1 * f + a3 * x)/Zb; a01 = (b1 * f + b3 * x)/Zb; a02 = (c1 * f + c3 * x)/Zb; a10 = (a2 * f + a3 * y)/Zb; a11 = (b2 * f + b3 * y)/Zb; a12 = (c2 * f + c3 * y)/Zb; a03 = y * sin(g_omga) -(x*(x*cos(g_kama)-y*sin(g_kama))/f + f*cos(g_kama))*cos(g_omga); a04 = -f*sin(g_kama) - x*(x*sin(g_kama)+y*cos(g_kama))/f; a05 = y; a13 = -x * sin(g_omga) -(y*(x*cos(g_kama)-y*sin(g_kama))/f - f*sin(g_kama))*cos(g_omga); //a13 = -x * sin(g_omga) -(x*(x*sin(g_kama)+y*cos(g_kama))/f - f*sin(g_kama))*cos(g_omga); a14 = -f*cos(g_kama) - y*(x*sin(g_kama)+y*cos(g_kama))/f; a15 = -x; vector vetmat; vetmat.push_back(2); vetmat.push_back(6); vetmat.push_back(a00);vetmat.push_back(a01);vetmat.push_back(a02); vetmat.push_back(a03);vetmat.push_back(a04);vetmat.push_back(a05); vetmat.push_back(a10);vetmat.push_back(a11);vetmat.push_back(a12); vetmat.push_back(a13);vetmat.push_back(a14);vetmat.push_back(a15); CCMat matret(vetmat); return matret; } //计算L CCMat lxly_get() { vector vetmat; vetmat.push_back(2);vetmat.push_back(1); vetmat.push_back(x - x_estimate); vetmat.push_back(y - y_estimate); CCMat matret(vetmat); return matret; } //读取初始条件: void readcondition(int numberofDot,istream streamin,ostream streamout ) { N = numberofDot; //控制点数据: for (int i(0);i< numberofDot;i++) { //streamout<<"请输入第"<>point.m_x>>point.m_y>>point.m_z>>point.m_xp>>point.m_yp; //streamin.clear(); vpoints.push_back(point); //streamout<>m; //streamin.clear(); //streamout<>H; //streamin.clear(); //streamout<<"请输入焦距:"; streamin>>f; //streamout<\n"; printMat(cout,result_i); //result_i = matA.turnAround().subMat(matA).reverseMat().subMat(matA.turnAround()).subMat(matL); double a; a = result_i[0][0]; g_Xs += result_i[0][0]; g_Ys += result_i[1][0]; g_Zs += result_i[2][0]; g_fai += result_i[3][0]; g_omga += result_i[4][0]; g_kama += result_i[5][0]; if((result_i[0][0]<=0.0000001 && result_i[0][0]>= -0.0000001 ) && (result_i[1][0]<=0.0000001 && result_i[1][0]>= -0.0000001 ) && (result_i[2][0]<=0.0000001 && result_i[2][0]>= -0.0000001 ) ) break; } cout<<"迭代次数是:"< "; cout.flush(); int _end; cin>>_end; cin.clear(); if(_end == 0) { ofstream file; file.open("result.txt"); file<<"迭代次数是:"< #include #include #include #include #include #include #include using namespace::std; class Clit { public: Clit(){it = NULL;} vector* vet; vector::iterator it; double& operator[](int j) { int i(it - (*vet).begin() +j); double& r=(*vet)[i]; return r; } }; class CCMat { public: CCMat():m_nX(0),m_nY(0){m_elements.clear();}; CCMat(CCMat* mat); CCMat(vector vet); CCMat(ifstream& file); CCMat(char* file); CCMat(CCMat& mat); CCMat operator=(CCMat& mat); ~CCMat(){m_elements.clear();} Clit operator[](int i); void add(int flg,CCMat& othermat); CCMat subMat(CCMat& rMat); //乘法 CCMat plusMat(CCMat& rmat); //加法 CCMat turnAround(); //转置 CCMat reverseMat(); //求逆矩阵 double valueofMat(const CCMat& mat, int i,int j);//求解代数余子式 void tobttingle(CCMat& mat); //化简为上三角行列式 private: public:int m_nX,m_nY; private: vector m_elements; }; void printMat(ostream& out,CCMat& mat); #else #endif #include #include #include #include #include #include #include #include #include "CCMat.h" using namespace::std; CCMat::CCMat(CCMat* mat) { m_nX=mat->m_nX;m_nY=mat->m_nY;m_elements = mat->m_elements; } CCMat::CCMat(CCMat& mat) { m_nX = mat.m_nX; m_nY = mat.m_nY; m_elements.resize(mat.m_elements.size()); copy(mat.m_elements.begin(),mat.m_elements.end(),m_elements.begin()); } CCMat::CCMat(vector vet) { if(vet.size()<3 || vet.size()!=vet[0]*vet[1] + 2) return; m_nX = vet[0]; m_nY = vet[1]; m_elements.resize(m_nX*m_nY); copy(vet.begin()+2,vet.end(),m_elements.begin()); } CCMat::CCMat(ifstream& file) { file>>m_nX; file>>m_nY; double val; while(!file.eof()&&!file.fail()&&m_elements.size()!=m_nX*m_nY) { file>>val; m_elements.push_back(val); } file.close(); if(m_elements.size()!=m_nX*m_nY) delete this; } CCMat::CCMat(char* file) { ifstream ofile(file); CCMat mat(ofile); m_nX = mat.m_nX; m_nY = mat.m_nY; m_elements = mat.m_elements; } Clit CCMat::operator[](int i) { Clit lit; if (i>=m_nX) throw new exception("The index may be out of range!"); if (i < 0 ) throw new exception("The index may be zero!"); lit.it = m_elements.begin()+(i*m_nY); lit.vet = &m_elements; return lit; } CCMat CCMat::operator=(CCMat& mat) { if(&mat == this) return *this; m_nX = mat.m_nX; m_nY = mat.m_nY; m_elements.resize(mat.m_elements.size()); copy(mat.m_elements.begin(),mat.m_elements.end(),m_elements.begin()); return *this; } CCMat CCMat::turnAround() { CCMat newmat,oldmat; oldmat = *this; newmat.m_nX = m_nY; newmat.m_nY = m_nX; for(int i=0;i
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: 空间后方交会
 输入关键字,在本站1000多万海量源码库中尽情搜索: