将地心下的坐标旋转平移到某块局部坐标下,然后逆运算反转回去,结果输出与输入值不一样,应该是旋转带来的误差,请问如何消除这种误差????
以下是测试代码:
double x,y,z;
osg::EllipsoidModel em;
em.convertLatLongHeightToXYZ(osg::inDegrees(39.123456),osg::inDegrees(116.123456),1000.0,x,y,z);
osg::Vec3d p(x,y,z);
p = p*osg::Matrixd::translate(2544540.0f, -4950970.0f, -3103160.0f);
p = p*osg::Matrixd::rotate(osg:egreesToRadians(58.0),osg::Vec3(1.0,0.0,0.0),
osg::DegreesToRadians(23.0),osg::Vec3(0.0,1.0,0.0),
osg::DegreesToRadians(-14.0), osg::Vec3(0.0,0.0,1.0));
p = p*osg::Matrixd::rotate(osg::DegreesToRadians(-58.0), osg::Vec3(1.0,0.0,0.0),
osg::DegreesToRadians(-23.0), osg::Vec3(0.0,1.0,0.0),
osg::DegreesToRadians(14.0), osg::Vec3(0.0,0.0,1.0));
p = p*osg::Matrixd::translate(-2544540.0f, 4950970.0f, 3103160.0f);
double lon,lat,hgt;
em.convertXYZToLatLongHeight(p.x(),p.y(),p.z(),lat,lon,hgt);
lon != 116.123456,lat!=39.123456,hgt!=1000.0, ???? |