高斯投影转换(3度带)

void BL2xy(double B,double L, double H, double tt[3])
{
/*****高斯投影正算.  大地坐标系转换为3度带的国家统一直角坐标系,地球参数用的是WGS84定义的椭球参数*****///得到的是旋转矩阵的平移参数
double L0;//中央子午线经度
int n = int((L + 1.5) / 3);
L0 = n * 3;


double N;//卯酉圈曲率半径
double t;
double η;
double X; //当前点到赤道的子午线长度 
double A0, A2, A4, A6, A8;//计算X的参数 
double RadB;
double ρ;
ρ = 180 * 3600 / PI;//定义弧秒值,近似于″   


double a = 6378137, b = 6356752.3142, e1, e2;  //椭球参数  
e1 = sqrt(a*a - b*b) / a;
e2 = sqrt(a*a - b*b) / b;


double deltaL;//经度L同当前带中央子午线的差值,单位为秒 
deltaL = (L - L0) * 3600;
RadB = B*PI / 180;


N = a / sqrt(1 - e1*e1*sin(RadB)*sin(RadB));
t = tan(RadB);
η = e2*cos(RadB);
A0 = 1 + 3.0 / 4 * pow(e1, 2) + 45.0 / 64 * pow(e1, 4) + 350.0 / 512 * pow(e1, 6) + 11025.0 / 16384 * pow(e1, 8);
A2 = -1.0 / 2 * (3.0 / 4 * e1*e1 + 60.0 / 64 * pow(e1, 4) + 525.0 / 512 * pow(e1, 6) + 17640.0 / 16384 * pow(e1, 8));
A4 = 1.0 / 4 * (15.0 / 64 * pow(e1, 4) + 210.0 / 512 * pow(e1, 6) + 8820.0 / 16384 * pow(e1, 8));
A6 = -1.0 / 6 * (35.0 / 512 * pow(e1, 6) + 2520.0 / 16384 * pow(e1, 8));
A8 = 1.0 / 8 * (315.0 / 16384 * pow(e1, 8));
X = a*(1 - pow(e1, 2))*(A0*RadB + A2*sin(2 * RadB) + A4*sin(4 * RadB) + A6*sin(6 * RadB) + A8*sin(8 * RadB));


tt[0] = X + N / (2 * pow(ρ, 2))*sin(RadB)*cos(RadB)*deltaL*deltaL + N / (24 * pow(ρ, 4))*sin(RadB)*pow(cos(RadB), 3)*(5 - t*t + 9 * pow(η, 2) + 4 * pow(η, 4))*pow(deltaL, 4) + N / (720 * pow(ρ, 6))*sin(RadB)*pow(cos(RadB), 5)*(61 - 58 * t*t + pow(t, 4))*pow(deltaL, 6);
tt[1] = N / ρ*cos(RadB)*deltaL + N / (6 * pow(ρ, 3))*pow(cos(RadB), 3)*(1 - t*t + η*η)*pow(deltaL, 3) + N / (120 * pow(ρ, 5))*pow(cos(RadB), 5)*(5 - 18 * t*t + pow(t, 4) + 14 * η*η - 58 * η*η*t*t)*pow(deltaL, 5)+500000;
tt[2] = H;
}

你可能感兴趣的:(算法)