### autosave

parent a1ec8b1d
 ... ... @@ -126,10 +126,12 @@ double GMST(int year, double hours){ hoursLeft = (hoursLeft + 12); }*/ D = ((julian(year, hours) - (hoursLeft / 24)) - 2451545.0); double T = D/36525; // centuries since Jan 1st 2000 AD if(DEBUG){ clog << "DEBUG: The GMST in days is: " << D << endl; } temp = 6.697374558 + 0.06570982441908*D + 1.00273790935*hoursLeft + (0.000026 * pow((D/36525), 2)); //temp = 67310.5481 + (876600* hoursLeft + 8640184.812866)*T + (0.09314 * pow(T, 2)) - ((6.2 * pow(10, -6)) * pow(T, 3)); temp = 6.697374558 + (0.06570982441908*D) + (1.00273790935*hoursLeft) + (0.000026 * pow(T, 2)); //temp = 18.697374558 + 24.06570982441908*D; if(DEBUG){ clog << fixed << "DEBUG: D has a value of: " << D << endl ... ... @@ -138,6 +140,7 @@ double GMST(int year, double hours){ } GMST = fmod(temp, 24.0); //GMST = temp; //GMST = modf((temp/24), &D) * 24; /*if(GMST > 24){ GMST -= 24; }*/ ... ... @@ -178,17 +181,18 @@ pair algorithm(double hours, pair latAndLongPair, temp = ((sin(a)*sin(phi)) + (cos(a) * cos(phi) * cos(A))); sigma = asin(temp); hourAngle = (-1 * sin(A) * cos(a)) / cos(sigma); //hourAngle = (-1 * sin(A) * cos(a)) / cos(sigma); hourAngle = (sin(a) - sin(sigma)*sin(phi)) / (cos(sigma) * cos(phi)); //cartesian to celestial //alpha = atan2(yPrime, xPrime) * (180 / M_PI); //sigma = asin(zPrime) * (180 / M_PI); alpha = (GMST(year, hours) + Long) - (asin(hourAngle) * (180 / M_PI)); alpha = (GMST(year, hours) - Long) - (acos(hourAngle) * (180 / M_PI)); if(DEBUG){ clog << fixed << setprecision(10) << "DEBUG: hourAngle has a value of: " << hourAngle << endl << "DEBUG: temp has a value of: " << temp << " and the arcsine of temp is: " << asin(temp) << endl << "DEBUG: sigma then has a value of: " << sigma * (180 / M_PI) << endl << "DEBUG: alpha has a value of: " << alpha << " which means that the LST is: " << (GMST(year, hours) + Long) << " and the hour angle is " << asin(hourAngle) * (180 / M_PI)<< endl; << "DEBUG: alpha has a value of: " << alpha << " which means that the LST is: " << (GMST(year, hours) + Long) << " and the hour angle is " << hourAngle << " and the arccos of the hour angle is: " << acos(hourAngle) * (180 / M_PI) << endl; //clog << "DEBUG: alpha has a value of: " << alpha << " and sigma has a value of: " << sigma * (180 / M_PI)<< endl; } ... ...
 ... ... @@ -29,11 +29,11 @@ int main(){ //calculating the julian date cout << "if the date is January 27, 2017 at 5:45:54.6 pm, the julian date function should return 2457781.240208." << endl << "It actually returns: " << julian(2017, 641.765166667) << endl; << "It actually returns: " << julian(2017, 641.9) << endl; cout << "if the date is January 27, 2017 at 5:45:54.6 pm, the GMST date function should return: 2.34623833333." << endl << "It actually returns: " << GMST(2017, 641.765166667) << endl; << "It actually returns: " << GMST(2017, 641.9) << endl; //converting time and longitude to phi /*cout << "if its January 27, 2034, 5:45 pm at a longitude of 49 the, phi should equal 4.65147698949." << endl << "Phi actually equals: " << timeToPhi(2034, 641.765166667, 49) << endl;*/ ... ... @@ -46,7 +46,7 @@ int main(){ horizontal.first = 20; horizontal.second = 270; pair returnValue; returnValue = algorithm(641.765166667, test, horizontal, 2017); returnValue = algorithm(641.9, test, horizontal, 2017); cout << "The algorithm function, when its January 27, 2017, at 5:45:54 pm, at a lat and long of -46,89 and when looking at the sky at 20, 270 (in horizontal coordinates), gives: " << endl << "Right ascention of: " << returnValue.first << " and a declination of: " << returnValue.second << endl; }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!