X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2FBody.hpp;h=1e32e6d020a41d71392d4f7ce68865aba6d96aaf;hb=f8c0f8706e51450ee0e87a548ccf3a66ee9f0db3;hp=165d8483f5cbc6d890b7280ec91d6ed85401e6b1;hpb=631f0cfd6b421f5be68d60375db2ce91176d923d;p=blobs.git diff --git a/src/world/Body.hpp b/src/world/Body.hpp index 165d848..1e32e6d 100644 --- a/src/world/Body.hpp +++ b/src/world/Body.hpp @@ -2,8 +2,10 @@ #define BLOBS_WORLD_BODY_HPP_ #include "Orbit.hpp" +#include "../math/geometry.hpp" #include "../math/glm.hpp" +#include #include @@ -47,6 +49,9 @@ public: const std::vector &Children() const noexcept { return children; } + const std::string &Name() const noexcept { return name; } + void Name(const std::string &n) noexcept { name = n; } + double Mass() const noexcept { return mass; } void Mass(double m) noexcept { mass = m; } @@ -56,9 +61,6 @@ public: Orbit &GetOrbit() noexcept { return orbit; } const Orbit &GetOrbit() const noexcept { return orbit; } - const glm::dvec2 &SurfaceTilt() const noexcept { return surface_tilt; } - void SurfaceTilt(const glm::dvec2 &t) noexcept { surface_tilt = t; } - const glm::dvec2 &AxialTilt() const noexcept { return axis_tilt; } void AxialTilt(const glm::dvec2 &t) noexcept { axis_tilt = t; } @@ -73,6 +75,14 @@ public: double GravitationalParameter() const noexcept; double OrbitalPeriod() const noexcept; double RotationalPeriod() const noexcept; + /// day length relative to parent, not neccessarily a sun + /// gives absolute value in seconds + /// returns sidereal day for parent-less bodies + double DayLength() const noexcept; + double SphereOfInfluence() const noexcept; + + math::Sphere CollisionBounds() const noexcept { return math::Sphere{ glm::dvec3(0.0), Radius() }; } + const glm::dmat4 &CollisionTransform() const noexcept { return local; } const glm::dmat4 &LocalTransform() const noexcept { return local; } const glm::dmat4 &InverseTransform() const noexcept { return inverse_local; } @@ -106,10 +116,10 @@ private: Simulation *sim; Body *parent; std::vector children; + std::string name; double mass; double radius; Orbit orbit; - glm::dvec2 surface_tilt; glm::dvec2 axis_tilt; double rotation; double angular;