1 #ifndef BLOBS_WORLD_BODY_HPP_
2 #define BLOBS_WORLD_BODY_HPP_
4 #include "../graphics/glm.hpp"
26 Body(const Body &) = delete;
27 Body &operator =(const Body &) = delete;
29 Body(Body &&) = delete;
30 Body &operator =(Body &&) = delete;
33 bool HasSimulation() const noexcept { return sim; }
34 const Simulation &GetSimulation() const noexcept { return *sim; }
35 void SetSimulation(Simulation &) noexcept;
37 bool HasParent() const { return parent; }
38 Body &Parent() { return *parent; }
39 const Body &Parent() const { return *parent; }
40 void SetParent(Body &);
43 double Mass() const noexcept;
44 void Mass(double) noexcept;
46 double Radius() const noexcept;
47 void Radius(double) noexcept;
49 double SemiMajorAxis() const noexcept;
50 void SemiMajorAxis(double) noexcept;
52 double Eccentricity() const noexcept;
53 void Eccentricity(double) noexcept;
55 double Inclination() const noexcept;
56 void Inclination(double) noexcept;
58 double LongitudeAscending() const noexcept;
59 void LongitudeAscending(double) noexcept;
61 double ArgumentPeriapsis() const noexcept;
62 void ArgumentPeriapsis(double) noexcept;
64 double MeanAnomaly() const noexcept;
65 void MeanAnomaly(double) noexcept;
67 double GravitationalParameter() const noexcept;
68 double OrbitalPeriod() const noexcept;
70 glm::mat4 ToParent() const noexcept;
71 glm::mat4 FromParent() const noexcept;
73 virtual void Draw(app::Assets &, graphics::Viewport &) { }
76 void AddChild(Body &);
77 void RemoveChild(Body &);
82 std::vector<Body *> children;
87 double sma; // semi-major axis
88 double ecc; // eccentricity
89 double inc; // inclination
90 double asc; // longitude of ascending node
91 double arg; // argument of periapsis
92 double mna; // mean anomaly (at t=0)