开发工具:
文件大小: 8kb
下载次数: 0
上传时间: 2011-12-15
详细说明: public class CoordTrans7Param { public double[,] values=new double[7,1]; //{{dx},{dy},{dz},{rx},{ry},{rz},{k}}; //public double 两个坐标系转换一般需要平移,旋转,缩放共七参数。 Y=(1+k)*M(x,y,z)*X+dX; public double[,] values=new double[7,1]; //{{dx},{dy},{dz},{rx},{ry},{rz},{k}}; //public double dx,dy,dz,rx,ry,rz,k; public void Set4Param(double dx,double dy,double dz,double k) { this.dx=dx; this.dy=dy; this.dz=dz; this.k=k; this.rx=this.ry=this.rz=0; } public void SetRotationParamRad(double rx,double ry,double rz) { thi s.rx=rx; this.ry=ry; this.rz=rz; } public void SetRotationParamMM(double rx,double ry,double rz) { SetRotationParamRad(rx*Math.PI/648000,ry*Math.PI/648000,rz*Math.PI/648000); } private double[,] GetMx() { double [,] Mx=new double[,] {{1,0,0}, {0,Math.Cos(rx),Math.Sin(rx)}, {0,-Math.Sin(rx),Math.Cos(rx)}}; return Mx; } private double[,] GetMy() { double [,] My=new double[,] {{Math.Cos(ry),0,-Math.Sin(ry)}, {0,1,0}, {Math.Sin(ry),0,Math.Cos(ry)}}; return My; } private double[,] GetMz() { double [,] Mz=new double[,] {{Math.Cos(rz),Math.Sin(rz),0}, {-Math.Sin(rz),Math.Cos(rz),0}, {0,0,1}}; return Mz; } private double[,] GetM() //M=Mx*My*Mz? or M=Mz*My*Mx? { double [,] M=new double[3,3]; MatrixTool.Multi(GetMz(),GetMy(),ref M); MatrixTool.Multi(M,GetMx(),ref M); return M; } private double[,] GetMdx() { double[,] mt = {{ 0, 0, 0 }, { 0, -Math.Sin(rx), Math.Cos(rx) }, { 0, -Math.Cos(rx), -Math.Sin(rx) }}; double[,] m=new double[3,3]; MatrixTool.Multi(GetMz(),GetMy(),ref m); MatrixTool.Multi(m,mt,ref m); return m; } private double[,] GetMdy() { double[,] mt = {{ -Math.Sin(ry), 0, -Math.Cos(ry) }, { 0, 0, 0 }, { Math.Cos(ry), 0, -Math.Sin(ry) }}; double[,] m=new double[3,3]; MatrixTool.Multi(GetMz(),mt,ref m); MatrixTool.Multi(m,GetMx(),ref m); return m; } private double[,] GetMdz() { double[,] mt = {{ -Math.Sin(rz), Math.Cos(rz), 0 }, { -Math.Cos(rz), -Math.Sin(rz), 0 }, { 0, 0, 0 }}; double[,] m=new double[3,3]; MatrixTool.Multi(mt,GetMy(),ref m); MatrixTool.Multi(m,GetMx(),ref m); return m; } private double[,] specialMulti(double[,] m,double[,] X) { int rowNumM=m.GetLength(0); int colNumM=m.GetLength(1); int rowNumX=X.GetLength(0); int colNumX=X.GetLength(1); int lines=rowNumX/colNumM; double[,] mt=MatrixTool.Init(rowNumM,colNumX); double[,] subX=MatrixTool.Init(colNumM,colNumX); double[,] res=MatrixTool.Init(rowNumM*lines,colNumX); for(int i=0;ivMax) vMax=Math.Abs(V[i,0]); } return vMax; } private bool isSmall() { double s=0; for(int i=0;i<7;i++) s+=Math.Abs(values[i,0]); if (s<0.0000001) return true; else return false; } public void TransCoord(double x1,double y1,double z1,out double x2,out double y2,out double z2) { double[,] Xi={{x1},{y1},{z1}}; double[,] DX={{dx},{dy},{dz}}; double[,] tY=new double[3,1]; double[,] K={{1+k}}; double [,] M=GetM(); MatrixTool.Multi(Xi,K,ref tY); MatrixTool.Multi(M,tY,ref tY); MatrixTool.Add(tY,DX,ref tY); x2=tY[0,0]; y2=tY[1,0]; z2=tY[2,0]; } public double dx { get { return values[0,0]; } set { values[0,0]=value; } } public double dy { get { return values[1,0]; } set { values[1,0]=value; } } public double dz { get { return values[2,0]; } set { values[2,0]=value; } } public double rx { get { return values[3,0]; } set { values[3,0]=value; } } public double ry { get { return values[4,0]; } set { values[4,0]=value; } } public double rz { get { return values[5,0]; } set { values[5,0]=value; } } public double k { get { return values[6,0]; } set { values[6,0]=value; } } } ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.