X-Git-Url: http://git.localhorst.tv/?p=blobs.git;a=blobdiff_plain;f=src%2Fworld%2FPlanet.hpp;h=f7efc585d6dbac8f58bf6ca0b3ae2cbddbcfedc2;hp=2034b8dc4c787b4f30e6a52eb87389402e1c1f95;hb=e35e0c2da8e86fc15cde78ab94c7d7273bd185c3;hpb=3989da924c4e33c52f500aead5ae62bb40294781 diff --git a/src/world/Planet.hpp b/src/world/Planet.hpp index 2034b8d..f7efc58 100644 --- a/src/world/Planet.hpp +++ b/src/world/Planet.hpp @@ -41,6 +41,8 @@ public: double ElevationAt(const glm::dvec3 &p) const noexcept { return glm::length(p) - Radius(); } /// distance to planet center double DistanceAt(const glm::dvec3 &p) const noexcept { return glm::length(p); } + /// acceleration due to gravity at given point + glm::dvec3 GravityAt(const glm::dvec3 &p) const noexcept { return NormalAt(p) * (-GravitationalParameter() / glm::length2(p)); } /// get ground tile Tile &TileAt(const glm::dvec3 &) noexcept;