GlobeEngine
Orbit.h
Go to the documentation of this file.
1 #ifndef ExoViewer_Orbit_h
2 #define ExoViewer_Orbit_h
3 
4 #include "OpenGL_Includes.h"
5 #include <math.h>
6 #include <vector>
7 #include <vmmlib/vmmlib.hpp>
8 #include "OrbitDrawable.h"
9 #include "Camera.h"
10 
11 namespace geAstro{
12 
13 //struct to hold orbit information, initalized to default values (earth orbit)
14 struct OrbitInfo
15 {
16  double eccentricity = 0.01;
17  double semimajorAxis = 1.0;
18  double inclination = 0.0004;
19  double longitudeOfAscendingNode = 135.08;
20  double argumentOfPeriapsis = 236.73;
21  double timeOfPeriapsis = 2451546.403877783101;
22  double meanMotion = 0.985;
23 };
24 
25 class Orbit
26 {
27 public:
28  Orbit();
29  ~Orbit();
30  void clear();
31  void create(OrbitInfo orbitInfo, vmml::Vector3d _center,
32  std::shared_ptr<ge::Shader> _programForOrbits, vmml::Vector3d _orbitColor,
33  bool _smallBodiesAsPointCloud, unsigned int _uid, unsigned int _groupuid, bool _isRealScale, double _scaleFactor); // = UINT_MAX);
34 
35  void update(double _date, bool _isRealScale, double _scaleFactor);
36  void draw(std::shared_ptr<ge::Camera> _cam);
37 
38  void setOrbitColor(vmml::Vector3f _orbitColor);
39  void setVisible(bool visible);
40 
41  vmml::Vector3d getPositionOnEllipsis(double _angle) const;
42  double getRadiusByTrueAnomaly(double _angle) const;
43 
44  vmml::Vector3d getCenterOfGravity() const;
45  void setCenterOfGravity(vmml::Vector3d _pos);
46 
47  vmml::Vector3d getCurrentBodyPosition() const;
48  const OrbitInfo& getOrbitData() const;
49  const OrbitDrawable& getOrbitDrawable() const;
50 
51  void reloadShader(std::shared_ptr<ge::Shader> _programForOrbits);
52  //double getPeriapsis(bool _scaled=false) const;
53 
54 private:
55  vmml::Vector3d rescale(bool _isRealScale, vmml::Vector3d _pos, double _scaleFactor) const;
56  double computeTrueAnomaly(double _date);
57  std::vector<vmml::Vector3d> getOrbitPoints(unsigned int _numberOfSegements, bool _isRealScale, double _scaleFactor) const;
58 
59  OrbitInfo orbitInfo;
60  OrbitDrawable drawable;
61 
62  vmml::Vector3d centerOfGravity;
63  vmml::Vector3d currentBodyLocation;
64 
65 };
66 
67 }
68 
69 #endif
const OrbitDrawable & getOrbitDrawable() const
Definition: Orbit.cpp:158
vmml::Vector3d getPositionOnEllipsis(double _angle) const
Definition: Orbit.cpp:99
~Orbit()
Definition: Orbit.cpp:11
double inclination
Definition: Orbit.h:18
void setVisible(bool visible)
Definition: Orbit.cpp:128
void update(double _date, bool _isRealScale, double _scaleFactor)
Definition: Orbit.cpp:52
void draw(std::shared_ptr< ge::Camera > _cam)
Definition: Orbit.cpp:124
double eccentricity
Definition: Orbit.h:16
double longitudeOfAscendingNode
Definition: Orbit.h:19
double getRadiusByTrueAnomaly(double _angle) const
Definition: Orbit.cpp:95
double argumentOfPeriapsis
Definition: Orbit.h:20
Definition: OrbitDrawable.h:11
void clear()
Definition: Orbit.cpp:15
Definition: Orbit.h:25
Definition: AstroCommon.h:18
void create(OrbitInfo orbitInfo, vmml::Vector3d _center, std::shared_ptr< ge::Shader > _programForOrbits, vmml::Vector3d _orbitColor, bool _smallBodiesAsPointCloud, unsigned int _uid, unsigned int _groupuid, bool _isRealScale, double _scaleFactor)
Definition: Orbit.cpp:31
Orbit()
Definition: Orbit.cpp:6
vmml::Vector3d getCurrentBodyPosition() const
Definition: Orbit.cpp:91
void reloadShader(std::shared_ptr< ge::Shader > _programForOrbits)
Definition: Orbit.cpp:162
void setOrbitColor(vmml::Vector3f _orbitColor)
Definition: Orbit.cpp:87
double meanMotion
Definition: Orbit.h:22
Definition: Orbit.h:14
void setCenterOfGravity(vmml::Vector3d _pos)
Definition: Orbit.cpp:136
double timeOfPeriapsis
Definition: Orbit.h:21
double semimajorAxis
Definition: Orbit.h:17
vmml::Vector3d getCenterOfGravity() const
Definition: Orbit.cpp:132
const OrbitInfo & getOrbitData() const
Definition: Orbit.cpp:154