diff --git a/Constants.cc b/Constants.cc new file mode 100644 index 0000000..f5606ca --- /dev/null +++ b/Constants.cc @@ -0,0 +1,11 @@ +#include "Constants.h" + +const double Constants::Pi = 3.14159265358979323846264; +const double Constants::c = 2.99792458e+8; +const double Constants::permeability = 4*3.14159265358979323846264*1.0e-007; +const double Constants::electron_mass = 0.510998910e-3; +const double Constants::proton_mass = 0.938272013; + +Constants::Constants(){} + +Constants::~Constants(){} diff --git a/Constants.h b/Constants.h new file mode 100644 index 0000000..1915670 --- /dev/null +++ b/Constants.h @@ -0,0 +1,25 @@ +#ifndef CONSTANTS_ORBIT +#define CONSTANTS_ORBIT + +class Constants { +public: + Constants(); + ~Constants(); + + //Pi + const static double PI; + + //Speed of light in m/sec + const static double c; + + //Magnetic permeability + const static double permeability; + + //Electron mass in GeV + const static double electron_mass; + + //Proton mass in GeV + const static double proton_mass; +} + +#endif diff --git a/Planet.cc b/Planet.cc index aa4a801..c41e547 100644 --- a/Planet.cc +++ b/Planet.cc @@ -4,7 +4,7 @@ #include #include "Planet.h" -Planet::Planet(int mass, int radius, Point origin, Vector heading): mass(mass), radius(radius), origin(origin), heading(heading) +Planet::Planet(int mass, int radius, int solar_system, Point origin, Vector heading): mass(mass), radius(radius), solar_system(solar_system), origin(origin), heading(heading) { } @@ -14,12 +14,14 @@ std::string Planet::toString() x << "Mass: " << mass << "\n" << "Radius: " << radius << "\n" + << "Solar System: " << solar_system << "\n" << "Position: " << origin.toString() << "\n" << "Heading: " << heading.toString() << "\n"; return x.str(); } + // Calculates the gravitational pull from this planet to a given planet P double Planet::calculateGravity(Planet &p) { diff --git a/Planet.h b/Planet.h index 59485e5..c51e3d7 100644 --- a/Planet.h +++ b/Planet.h @@ -10,13 +10,14 @@ class Planet public: int mass; int radius; + int solar_system; Point origin; Vector heading; std::string toString(); - Planet(int mass, int radius, Point position, Vector heading); + Planet(int mass, int radius, int solar_system, Point position, Vector heading); void distance(Planet &p, double &horizontalDistance, double &verticalDistance); double calculateGravity(Planet &p); Vector findVector(Planet &p);