### autosave

parent 47f89c3e
 ... ... @@ -102,7 +102,7 @@ double julian(double year, double hours){ } days += dayWhole; hoursLeft = dayFract * 24;//counts the left over hours that aren't days if(hoursLeft != 0){ /*if(hoursLeft != 0){ if(hoursLeft >= 12) { //turns the left over hours into seconds since noon (12pm) seconds = (hoursLeft - 12) * 360; } else { ... ... @@ -110,12 +110,17 @@ double julian(double year, double hours){ } } else { //seconds = 43200; }*/ if(DEBUG){ clog < JD0){ hoursLeft = (JD - JD0) *24; } else { ... ... @@ -144,18 +149,13 @@ double GMST(int year, double hours){ << "DEBUG: The value of JD0 is: " << JD0 << " and the value of D0 " << D0 << endl; } temp = 6.697374558 + (0.06570982441908*D0) + (1.00273790935*hoursLeft) + (0.000026 * pow(T, 2)); //temp = if(DEBUG){ clog << fixed << "DEBUG: D has a value of: " << D << endl << "DEBUG: temp has a value of: " << temp << endl << "DEBUG: hours left has a value of: " << hoursLeft << endl; } GMST = fmod(temp, 24) ; //GMST = temp; //GMST = modf((temp/24), &D) * 24; /*if(GMST > 24){ GMST -= 24; }*/ if(DEBUG){ clog << "DEBUG: GMST has a value of: " << GMST << endl; } ... ... @@ -193,23 +193,26 @@ 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 = (sin(a) - (sin(sigma)*sin(phi))) / (cos(sigma) * cos(phi)); 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) * 15 - Long) - (acos(hourAngle) * (180 / M_PI)); alpha = (GMST(year, hours) * 15 - Long) - (asin(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)*15 - Long) << " and the hour angle is " << hourAngle << " and the arccos of the hour angle is: " << acos(hourAngle) * (180 / M_PI) << endl; << "DEBUG: alpha has a value of: " << alpha << " which means that the LST is: " << (GMST(year, hours)*15 - Long) << " and the hour angle is " << hourAngle << " and the arccos of the hour angle is: " << asin(hourAngle) * (180 / M_PI) << endl; //clog << "DEBUG: alpha has a value of: " << alpha << " and sigma has a value of: " << sigma * (180 / M_PI)<< endl; } raAndDecPair.first = alpha; raAndDecPair.second = sigma * (180 / M_PI); if(DEBUG){ clog << "DEBUG: The final point is: (" << raAndDecPair.first << "," << raAndDecPair.second << ")." << endl; } return raAndDecPair; ... ...
 ... ... @@ -32,7 +32,7 @@ int main(){ << "It actually returns: " << julian(2017, 641.9) << endl; cout << "if the date is January 1, 2019 at 08:00:00, the GMST date function should return: 6.79519916667." << endl cout << "if the date is January 1, 2000 at 08:00:00, the GMST date function should return: 6.79519916667." << endl << "It actually returns: " << GMST(2019, 8) << 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 ... ... @@ -46,7 +46,7 @@ int main(){ horizontal.first = 20; horizontal.second = 270; pair returnValue; returnValue = algorithm(641.9, test, horizontal, 2017); returnValue = algorithm(8, test, horizontal, 2019); 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!