Hello, I have been tasked with writing a test application to convert between geographic coordinate systems. Now math is not my strong suit but I was assured I wouldn't actually have to do any of the calculations since the formulas are provided. The trouble is trying to get the lengthy formulas written in C++ so that the order of operations stays the same.
Like I said, math is not my strong suit, generally I see a lengthy equation and I go all cross eyed. And since I'm not getting to correct answers from my program I'm going to assume its a math error somewhere.
Anyway, I was hoping someone with a little more mathematical know how might take a crack at formatting these equations for C++.
Here's how I have them written:
float K1 = M * k0; float K2 = k0 * nu * ((sin(2 * lat))/4); float K3 = ((k0 * nu * sin(lat)) * (pow(cos(lat),3))/24) * ((5 - pow(tan(lat),2)) + (9* esq * pow(cos(lat),2)) + (4 * pow(esq,2) * pow(cos(lat),4))); float y = K1 + (K2 * pow(p,2)) + (K3 * pow(p,4)); float northing = y; float K4 = k0 * nu * cos(lat); float K5 = ((k0 * nu * pow(cos(lat),3))/6) * (1 - (pow(tan(lat),2) + (esq * pow(cos(lat),2)))); float x = (K4 * p) + (K5 * pow(p,3)); float easting = x;
and I've attached a screen shot of the formulas presented to me rather try and mess with formatting superscripts :D