forked from zpb1992/ReentryTrajectoryGuide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStar.cpp
47 lines (38 loc) · 781 Bytes
/
Star.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "Star.h"
#include "json\json.h"
#include<fstream>
#include"Math.h"
Star::Star(std::string filename) :Configuration(filename)
{
readConfig(_fileName);
}
Star::~Star()
{
}
bool Star::readConfig(std::string filename)
{
Json::Reader reader;
std::ifstream ifs(filename);
Json::Value root;
reader.parse(ifs, root);
_rotationW = 2.0*Math::PI / (24 * 3600);
_radius = root[getKeyByVar(ToString(_radius))].asDouble();
_gravityAcc = root[getKeyByVar(ToString(_gravityAcc))].asDouble();
return true;
}
bool Star::writeConfig(std::string filename)
{
return false;
}
double Star::getGravityAcc(double radius)
{
return _radius*_radius*_gravityAcc / (radius*radius);
}
double Star::getRotationW()
{
return _rotationW;
}
double Star::getRadius()
{
return _radius;
}