Commit bd8d1f68 authored by Elon Bontemps's avatar Elon Bontemps
Browse files

Merge branch 'master' of gitlab.cs.wallawalla.edu:walser/project-3-star-gazing

parents 7c040dd6 9bb3230f
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <utility> #include <utility>
#include <cmath> #include <cmath>
#include <iostream> #include <iostream>
#include <iomanip>
const bool DEBUG = true; const bool DEBUG = true;
//the main algorithm function converts //the main algorithm function converts
...@@ -45,16 +46,20 @@ double timeToPhi(int year, double hours, double longitude){ ...@@ -45,16 +46,20 @@ double timeToPhi(int year, double hours, double longitude){
//convert the date to a julian date; //convert the date to a julian date;
double julian(double year, double hours){ double julian(double year, double hours){
double leap, notLeap, dayFract, dayWhole; double leap = 0;
double notLeap, dayFract, dayWhole;
double julian, years, days, seconds, hoursLeft; double julian, years, days, seconds, hoursLeft;
years = year + 4713 + 1;//years is current year (AD or CE) 4713 is the start of the julian calender 1 is 0 AD/CE years = year + 4712;//years is current year (AD or CE) 4713 is the start of the julian calender 1 is 0 AD/CE
if(DEBUG){ if(DEBUG){
clog << "DEBUG: years has a value of: " << years << endl; clog << "DEBUG: years has a value of: " << years << endl;
} }
for(int i = -4713; i <= year; i++){ //counts number of leap years for(int i = -4713; i <= year; i++){ //counts number of leap years
if(i <= 1582){//before the switch to gregorian calenders, leap years were every 4 years if(i < 1582){//before the switch to gregorian calenders, leap years were every 4 years
if(i % 4 == 0){ if(i % 4 == 0){
leap++; leap++;
/* if(DEBUG){
clog <<"DEBUG: " << i << " is a leap year." << endl;
} */
} }
}else{ //after the switch the gregorian calenders, leap years weren't counted on centries unless it was divisible by 0 }else{ //after the switch the gregorian calenders, leap years weren't counted on centries unless it was divisible by 0
if(i % 4 == 0){ if(i % 4 == 0){
...@@ -74,7 +79,11 @@ double julian(double year, double hours){ ...@@ -74,7 +79,11 @@ double julian(double year, double hours){
} }
} else { } else {
leap++; leap++;
/* if(DEBUG){
clog << "DEBUG: " << i << " is a leap year." << endl;
} */
} }
} }
} }
} }
...@@ -82,22 +91,30 @@ double julian(double year, double hours){ ...@@ -82,22 +91,30 @@ double julian(double year, double hours){
if(DEBUG){ if(DEBUG){
clog << "DEBUG: There are " << leap << " leap years and " << notLeap << " non leap years totalling " << leap + notLeap << " years." << endl; clog << "DEBUG: There are " << leap << " leap years and " << notLeap << " non leap years totalling " << leap + notLeap << " years." << endl;
} }
days = ((leap * 366) + (notLeap * 365)) - 10; days = (leap * 366) + (notLeap * 365) - 10;
if(DEBUG){
clog << "DEBUG: days of leap years is: " << leap * 366 << ". Days of non leap years is: " << notLeap * 365 <<"." << endl
<< "DEBUG: The current value of Days is: " << days << endl;
}
dayFract = modf((hours / 24), &dayWhole); dayFract = modf((hours / 24), &dayWhole);
if(DEBUG){ if(DEBUG){
clog << "DEBUG: The value of dayFract is: " << dayFract << " and the value of dayWhole is: " << dayWhole << endl; clog << "DEBUG: The value of dayFract is: " << dayFract << " and the value of dayWhole is: " << dayWhole << endl;
} }
days += dayWhole; days += dayWhole;
hoursLeft = dayFract * 24;//counts the left over hours that aren't days hoursLeft = dayFract * 24;//counts the left over hours that aren't days
if(hoursLeft >= 12){ //turns the left over hours into seconds since noon (12pm) if(hoursLeft != 0){
seconds = (hoursLeft - 12) * 360; if(hoursLeft >= 12) { //turns the left over hours into seconds since noon (12pm)
seconds = (hoursLeft - 12) * 360;
} else {
seconds = (hoursLeft + 12) * 360;
}
} else { } else {
seconds = (hoursLeft + 12) * 360; //seconds = 43200;
} }
if(DEBUG){ if(DEBUG){
clog << "DEBUG: Days has a value of " << days << " hoursLeft has a value of " << hoursLeft << " while seconds has value of: " << seconds << endl; clog << "DEBUG: Days has a value of " << days << " hoursLeft has a value of " << hoursLeft << " while seconds has value of: " << seconds << endl;
} }
days += seconds / 86400; days += (seconds / 86400);
return days; return days;
} }
...@@ -105,15 +122,43 @@ double julian(double year, double hours){ ...@@ -105,15 +122,43 @@ double julian(double year, double hours){
//converts the hours and year to GMST (Greenwich Mean Sidereal Time) //converts the hours and year to GMST (Greenwich Mean Sidereal Time)
double GMST(int year, double hours){ double GMST(int year, double hours){
//JD is the julian date (days since jan 1st, 4713 BC) and D is days since Jan 1st 2000 //JD is the julian date (days since jan 1st, 4713 BC) and D is days since Jan 1st 2000
double JD, D, GMST; double D, GMST, temp, JD0;
JD = julian(year, hours); //double hoursLeft = modf((hours/24), &temp) * 24; // hours since the previous midnight
D = JD - 2451545.0; //hoursLeft = (hoursLeft + 12);
GMST = fmod(D, 24); double JD = julian(year, hours);
//double JDmin = floor(JD) - 0.5;
//double JDmax = floor(JD) + 0.5;
JD0 = floor(JD) + 0.5;
D = ( JD - 2451545.0);
double D0 = JD0 - 2451545.0;
double T = D/36525; // centuries since Jan 1st 2000 AD
double hoursLeft = (JD -JD0) *24;
if(DEBUG){
clog << fixed << setprecision(10) << "DEBUG: The GMST in days is: " << D << endl
<< "DEBUG: The value of JD is: " << JD << endl
<< "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));
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;
}
return GMST; return GMST;
} }
//converts geographic coordinates to celestial coooriantes (right ascention and deckination) and retruns a deque with the names of all the constellations //converts geographic coordinates to celestial coooriantes (right ascention and deckination) and retruns a deque with the names of all the constellations
//latAndLongpair has lat as the first and long as the second //latAndLongpair has lat as the first and long as the second
//alt and azi pair has altitude as the first and azimuth as the second //alt and azi pair has altitude as the first and azimuth as the second
...@@ -121,23 +166,48 @@ pair<double,double> algorithm(double hours, pair<double, double> latAndLongPair, ...@@ -121,23 +166,48 @@ pair<double,double> algorithm(double hours, pair<double, double> latAndLongPair,
//the map is in celestial coordinates //the map is in celestial coordinates
pair<double,double> raAndDecPair; pair<double,double> raAndDecPair;
//char constellationMap[ROW_MAX][COl_MAX]; //char constellationMap[ROW_MAX][COl_MAX];
double theta = latToTheta(latAndLongPair.first); //double theta = latToTheta(latAndLongPair.first);
double phi = timeToPhi(year, hours, latAndLongPair.second); //double phi = timeToPhi(year, hours, latAndLongPair.second);
double x, y, z; double phi = latAndLongPair.first * (M_PI / 180);
double xPrime, yPrime, zPrime, alpha, sigma; double hourAngle;
double alpha, sigma, temp;
double a = altAndAziPair.first * (M_PI / 180); // altitude
double A = altAndAziPair.second * (M_PI / 180); // azimuth
double lat = latAndLongPair.first; // latitude
double Long = latAndLongPair.second; // longitude
double hoursLeft = modf((hours/24), &temp) * 24;
//double x, y, z;
//double xPrime, yPrime, zPrime, alpha, sigma;
//converting the horizontal coordinates to cartesian coordinates //converting the horizontal coordinates to cartesian coordinates
horizontalToCart(altAndAziPair.first, altAndAziPair.second, x, y , z); //horizontalToCart(altAndAziPair.first, altAndAziPair.second, x, y , z);
xPrime = (x*cos(phi)*cos(theta)) + y*sin(phi) + (z*cos(phi)*sin(theta)); //xPrime = (x*cos(phi)*cos(theta)) + y*sin(phi) + (z*cos(phi)*sin(theta));
yPrime = (-1*x*sin(phi)*cos(theta)) + y*cos(theta) + (-1*z*sin(phi)*sin(theta)); //yPrime = (-1*x*sin(phi)*cos(theta)) + y*cos(theta) + (-1*z*sin(phi)*sin(theta));
zPrime = (-1*x*sin(theta)) + z*cos(theta); //zPrime = (-1*x*sin(theta)) + z*cos(theta);
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));
//cartesian to celestial //cartesian to celestial
alpha = atan2(yPrime, xPrime); //alpha = atan2(yPrime, xPrime) * (180 / M_PI);
sigma = asin(zPrime); //sigma = asin(zPrime) * (180 / M_PI);
alpha = (GMST(year, hours) * 15 - 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)*15 - 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;
}
raAndDecPair.first = alpha; raAndDecPair.first = alpha;
raAndDecPair.second = sigma; raAndDecPair.second = sigma * (180 / M_PI);
return raAndDecPair; return raAndDecPair;
} }
the algorithm function is sourced from "Trasforming Geographic to Celestial Coordinates" by Michael McEllis
\ No newline at end of file
...@@ -11,7 +11,7 @@ int main(){ ...@@ -11,7 +11,7 @@ int main(){
//declaration of variables //declaration of variables
double x, y, z; double x, y, z;
//testing horizontal to cart conversion function //testing horizontal to cart conversion function
horizontalToCart(24, 46, x, y, z); /* horizontalToCart(24, 46, x, y, z);
cout << "When the altitude is 24 and the azimuth is 46 (in degrees):" << endl cout << "When the altitude is 24 and the azimuth is 46 (in degrees):" << endl
<< "X = " << x << endl << "X = " << x << endl
<< "Y = " << y << endl << "Y = " << y << endl
...@@ -20,18 +20,33 @@ int main(){ ...@@ -20,18 +20,33 @@ int main(){
cout << "The values should be: " << endl cout << "The values should be: " << endl
<< "X = 0.634601998946" << endl << "X = 0.634601998946" << endl
<< "Y = -0.657149607101" << endl << "Y = -0.657149607101" << endl
<< "Z = 0.406736643076" << endl; << "Z = 0.406736643076" << endl;*/
//converting latitude to theta //converting latitude to theta
cout << "if th latitude is -46, then the latToTheta function should return 136." << endl /* cout << "if th latitude is -46, then the latToTheta function should return 136." << endl
<< "It actually returns: " << latToTheta(-46) << endl; << "It actually returns: " << latToTheta(-46) << endl;*/
//calculating the julian date //calculating the julian date
cout << "if the date is January 27, 2034 at 5:45:54.6 pm, the julian date function should return 2463990.240215." << endl 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(2034, 641.765166667) << endl; << "It actually returns: " << julian(2017, 641.9) << endl;
cout << "if the date is January 1, 2000 at 00:00:00, the GMST date function should return: 6.79519916667." << endl
<< "It actually returns: " << GMST(2000, 0) << endl;
//converting time and longitude to phi //converting time and longitude to phi
// cout << "if its January 27, 2034, 5:45 pm at a longitude of 49 the, phi should equal 13.24." << endl /*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, 648.45, 49) << endl; << "Phi actually equals: " << timeToPhi(2034, 641.765166667, 49) << endl;*/
//test the algorithm as a whole
pair<double, double> test;
test.first = -46;
test.second = 89;
pair<double,double> horizontal;
horizontal.first = 20;
horizontal.second = 270;
pair<double,double> returnValue;
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;
} }
#include "Functions.h" #include "Functions.h"
#include "Stars.h"
#include "Constellation.h"
#include <string> #include <string>
#include <iostream> #include <iostream>
#include <vector> #include <vector>
...@@ -136,7 +138,7 @@ pair<double,double> altAndAziPair () { ...@@ -136,7 +138,7 @@ pair<double,double> altAndAziPair () {
} }
} while (true); } while (true);
do { do { // Prompt and check for cardinal direction
cout << "Enter a cardinal direction (North, South, East, West, Northeast, Southeast, Southwest, or Northwest): "; cout << "Enter a cardinal direction (North, South, East, West, Northeast, Southeast, Southwest, or Northwest): ";
cin >> direction; cin >> direction;
...@@ -174,7 +176,6 @@ pair<double,double> altAndAziPair () { ...@@ -174,7 +176,6 @@ pair<double,double> altAndAziPair () {
return aziPair; return aziPair;
} }
double dateToHour (string month, int year, int day, int hour, int minute) { // Converts the date into hours double dateToHour (string month, int year, int day, int hour, int minute) { // Converts the date into hours
//variables //variables
double totHours = 0; double totHours = 0;
...@@ -221,7 +222,7 @@ double dateToHour (string month, int year, int day, int hour, int minute) { // C ...@@ -221,7 +222,7 @@ double dateToHour (string month, int year, int day, int hour, int minute) { // C
return totHours; return totHours;
} }
bool isLeap (int year) { // bool check for leap year bool isLeap (int year) { // bool check for leap years
if ((year % 4) == 0) { if ((year % 4) == 0) {
return true; return true;
} else { } else {
...@@ -238,26 +239,26 @@ vector <pair<double, double>> viewFinder (pair <double, double> centerPt) { // f ...@@ -238,26 +239,26 @@ vector <pair<double, double>> viewFinder (pair <double, double> centerPt) { // f
pair<double, double> pair4; pair<double, double> pair4;
if (centerPt.second > 0) { if (centerPt.second > 0) {
if (centerPt.first > 20.125 && centerPt.second < 51) { // done if (centerPt.first > 20.125 && centerPt.second < 51) {
for(int i = 0; i < 4; i++) { for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point if (i == 0) { // top left point
pair1 = make_pair((centerPt.first + 3.875) - 24, centerPt.second + 39); pair1 = make_pair((centerPt.first + 3.875) - 24, centerPt.second + 39);
corners.push_back(pair1); corners.push_back(pair1);
} else if (i == 1) { // top right point } else if (i == 1) { // top right point
pair2 = make_pair(centerPt.first - 3.875), centerPt.second + 39); pair2 = make_pair((centerPt.first - 3.875), centerPt.second + 39);
corners.push_back(pair2); corners.push_back(pair2);
} else if (i == 2) { // bottom left point } else if (i == 2) { // bottom left point
pair3 = make_pair((centerPt.first + 3.875) - 24, centerPt.second - 39); pair3 = make_pair((centerPt.first + 3.875) - 24, centerPt.second - 39);
corners.push_back(pair3); corners.push_back(pair3);
} else if (i == 3) { // bottom right point } else if (i == 3) { // bottom right point
pair4 = make_pair(centerPt.first - 3.875), centerPt.second - 39); pair4 = make_pair((centerPt.first - 3.875), centerPt.second - 39);
corners.push_back(pair4); corners.push_back(pair4);
} }
} }
} else if (centerPt.first < 3.875 && centerPt.second < 51) { // done } else if (centerPt.first < 3.875 && centerPt.second < 51) {
for(int i = 0; i < 4; i++) { for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point if (i == 0) { // top left point
pair1 = make_pair(centerPt.first + 3.875), centerPt.second + 39); pair1 = make_pair((centerPt.first + 3.875), centerPt.second + 39);
corners.push_back(pair1); corners.push_back(pair1);
} else if (i == 1) { // top right point } else if (i == 1) { // top right point
pair2 = make_pair(24 - (3.875 - centerPt.first), centerPt.second + 39); pair2 = make_pair(24 - (3.875 - centerPt.first), centerPt.second + 39);
...@@ -270,7 +271,7 @@ vector <pair<double, double>> viewFinder (pair <double, double> centerPt) { // f ...@@ -270,7 +271,7 @@ vector <pair<double, double>> viewFinder (pair <double, double> centerPt) { // f
corners.push_back(pair4); corners.push_back(pair4);
} }
} }
} else if (centerPt.first > 20.125 && centerPt.second > 51) { // done } else if (centerPt.first > 20.125 && centerPt.second > 51) {
for(int i = 0; i < 4; i++) { for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point if (i == 0) { // top left point
pair1 = make_pair((centerPt.first + 3.875) - 24, -90 + (centerPt.second - 51)); pair1 = make_pair((centerPt.first + 3.875) - 24, -90 + (centerPt.second - 51));
...@@ -286,7 +287,7 @@ vector <pair<double, double>> viewFinder (pair <double, double> centerPt) { // f ...@@ -286,7 +287,7 @@ vector <pair<double, double>> viewFinder (pair <double, double> centerPt) { // f
corners.push_back(pair4); corners.push_back(pair4);
} }
} }
} else if (centerPt.first < 3.875 && centerPt.second > 51) { // done } else if (centerPt.first < 3.875 && centerPt.second > 51) {
for(int i = 0; i < 4; i++) { for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point if (i == 0) { // top left point
pair1 = make_pair(centerPt.first + 3.875, -90 + (centerPt.second - 51)); pair1 = make_pair(centerPt.first + 3.875, -90 + (centerPt.second - 51));
...@@ -302,7 +303,7 @@ vector <pair<double, double>> viewFinder (pair <double, double> centerPt) { // f ...@@ -302,7 +303,7 @@ vector <pair<double, double>> viewFinder (pair <double, double> centerPt) { // f
corners.push_back(pair4); corners.push_back(pair4);
} }
} }
} else if ((centerPt.first < 20.125 && centerPt.first > 3.875) && centerPt.second > 51) { // done } else if ((centerPt.first < 20.125 && centerPt.first > 3.875) && centerPt.second > 51) {
for(int i = 0; i < 4; i++) { for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point if (i == 0) { // top left point
pair1 = make_pair(centerPt.first + 3.875, -90 + (centerPt.second - 51)); pair1 = make_pair(centerPt.first + 3.875, -90 + (centerPt.second - 51));
...@@ -318,7 +319,7 @@ vector <pair<double, double>> viewFinder (pair <double, double> centerPt) { // f ...@@ -318,7 +319,7 @@ vector <pair<double, double>> viewFinder (pair <double, double> centerPt) { // f
corners.push_back(pair4); corners.push_back(pair4);
} }
} }
} else if ((centerPt.first < 20.125 && centerPt.first > 3.875) && centerPt.second < 51) { // done } else if ((centerPt.first < 20.125 && centerPt.first > 3.875) && centerPt.second < 51) {
for(int i = 0; i < 4; i++) { for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point if (i == 0) { // top left point
pair1 = make_pair(centerPt.first + 3.875, centerPt.second + 39); pair1 = make_pair(centerPt.first + 3.875, centerPt.second + 39);
...@@ -336,26 +337,26 @@ vector <pair<double, double>> viewFinder (pair <double, double> centerPt) { // f ...@@ -336,26 +337,26 @@ vector <pair<double, double>> viewFinder (pair <double, double> centerPt) { // f
} }
} }
} else if (centerPt.second < 0) { } else if (centerPt.second < 0) {
if (centerPt.first > 20.125 && centerPt.second > -51) { // done if (centerPt.first > 20.125 && centerPt.second > -51) {
for(int i = 0; i < 4; i++) { for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point if (i == 0) { // top left point
pair1 = make_pair((centerPt.first + 3.875) - 24, centerPt.second + 39); pair1 = make_pair((centerPt.first + 3.875) - 24, centerPt.second + 39);
corners.push_back(pair1); corners.push_back(pair1);
} else if (i == 1) { // top right point } else if (i == 1) { // top right point
pair2 = make_pair(centerPt.first - 3.875), centerPt.second + 39); pair2 = make_pair((centerPt.first - 3.875), centerPt.second + 39);
corners.push_back(pair2); corners.push_back(pair2);
} else if (i == 2) { // bottom left point } else if (i == 2) { // bottom left point
pair3 = make_pair((centerPt.first + 3.875) - 24, centerPt.second - 39); pair3 = make_pair((centerPt.first + 3.875) - 24, centerPt.second - 39);
corners.push_back(pair3); corners.push_back(pair3);
} else if (i == 3) { // bottom right point } else if (i == 3) { // bottom right point
pair4 = make_pair(centerPt.first - 3.875), centerPt.second - 39); pair4 = make_pair((centerPt.first - 3.875), centerPt.second - 39);
corners.push_back(pair4); corners.push_back(pair4);
} }
} }
} else if (centerPt.first < 3.875 && centerPt.second > -51) { // done } else if (centerPt.first < 3.875 && centerPt.second > -51) {
for(int i = 0; i < 4; i++) { for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point if (i == 0) { // top left point
pair1 = make_pair(centerPt.first + 3.875), centerPt.second + 39); pair1 = make_pair((centerPt.first + 3.875), centerPt.second + 39);
corners.push_back(pair1); corners.push_back(pair1);
} else if (i == 1) { // top right point } else if (i == 1) { // top right point
pair2 = make_pair(24 - (3.875 - centerPt.first), centerPt.second + 39); pair2 = make_pair(24 - (3.875 - centerPt.first), centerPt.second + 39);
...@@ -368,7 +369,7 @@ vector <pair<double, double>> viewFinder (pair <double, double> centerPt) { // f ...@@ -368,7 +369,7 @@ vector <pair<double, double>> viewFinder (pair <double, double> centerPt) { // f
corners.push_back(pair4); corners.push_back(pair4);
} }
} }
} else if (centerPt.first > 20.125 && centerPt.second < -51) { // done } else if (centerPt.first > 20.125 && centerPt.second < -51) {
for(int i = 0; i < 4; i++) { for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point if (i == 0) { // top left point
pair1 = make_pair((centerPt.first + 3.875) - 24, centerPt.second + 39); pair1 = make_pair((centerPt.first + 3.875) - 24, centerPt.second + 39);
...@@ -438,7 +439,7 @@ vector <pair<double, double>> viewFinder (pair <double, double> centerPt) { // f ...@@ -438,7 +439,7 @@ vector <pair<double, double>> viewFinder (pair <double, double> centerPt) { // f
return corners; return corners;
} }
vector <pair<double, double>> constellationCoordinates () { vector <pair<double, double>> constellationCoordinates () { // Function to store the coordinates of the constellations
vector <pair<double, double>> coordinates; vector <pair<double, double>> coordinates;
// Canis Major // Canis Major
pair<double, double> pair1a; pair<double, double> pair1a;
...@@ -604,7 +605,7 @@ vector <pair<double, double>> constellationCoordinates () { ...@@ -604,7 +605,7 @@ vector <pair<double, double>> constellationCoordinates () {
pair<double, double> pair12c; pair<double, double> pair12c;
pair12c = make_pair(18.0, -42.0); pair12c = make_pair(18.0, -42.0);
coordinates.push_back(pair12c); coordinates.push_back(pair12c);
pair<double, double> pair1d; pair<double, double> pair12d;
pair12d = make_pair(16.0, -42.0); pair12d = make_pair(16.0, -42.0);
coordinates.push_back(pair12d); coordinates.push_back(pair12d);
...@@ -615,7 +616,7 @@ vector <pair<double, double>> constellationCoordinates () { ...@@ -615,7 +616,7 @@ vector <pair<double, double>> constellationCoordinates () {
pair<double, double> pair13b; pair<double, double> pair13b;
pair13b = make_pair(20.3, -12.0); pair13b = make_pair(20.3, -12.0);
coordinates.push_back(pair13b); coordinates.push_back(pair13b);
pair<double, double> pair1c; pair<double, double> pair13c;
pair13c = make_pair(21.8, -28.0); pair13c = make_pair(21.8, -28.0);
coordinates.push_back(pair13c); coordinates.push_back(pair13c);
pair<double, double> pair13d; pair<double, double> pair13d;
...@@ -629,7 +630,7 @@ vector <pair<double, double>> constellationCoordinates () { ...@@ -629,7 +630,7 @@ vector <pair<double, double>> constellationCoordinates () {
pair<double, double> pair14b; pair<double, double> pair14b;
pair14b = make_pair(21.2, 30.0); pair14b = make_pair(21.2, 30.0);
coordinates.push_back(pair14b); coordinates.push_back(pair14b);
pair<double, double> pair1c; pair<double, double> pair14c;
pair14c = make_pair(.2, 6.0); pair14c = make_pair(.2, 6.0);
coordinates.push_back(pair14c); coordinates.push_back(pair14c);
pair<double, double> pair14d; pair<double, double> pair14d;
...@@ -671,32 +672,118 @@ vector <pair<double, double>> constellationCoordinates () { ...@@ -671,32 +672,118 @@ vector <pair<double, double>> constellationCoordinates () {
pair<double, double> pair17b; pair<double, double> pair17b;
pair17b = make_pair(8.6, 61.0); pair17b = make_pair(8.6, 61.0);
coordinates.push_back(pair17b); coordinates.push_back(pair17b);
pair<double, double> pair1c; pair<double, double> pair17c;
pair17c = make_pair(13.7, 32.0); pair17c = make_pair(13.7, 32.0);
coordinates.push_back(pair17c); coordinates.push_back(pair17c);
pair<double, double> pair1d; pair<double, double> pair17d;
pair17d = make_pair(8.6, 32.0); pair17d = make_pair(8.6, 32.0);
coordinates.push_back(pair17d); coordinates.push_back(pair17d);
} }
void viewWindow (vector <pair<double,double>> corners, pair<double,double> constellationCoord) { void printConstellation (vector <pair<double,double>> constellationCoordinates, vector <pair<double,double>> window) {
pair<double,double> coordinates1; int inrangeCount = 0;
pair<double,double> coordinates2;