From f8c0f8706e51450ee0e87a548ccf3a66ee9f0db3 Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Mon, 18 Dec 2017 12:15:07 +0100 Subject: [PATCH] remove surface tilt legacy from non-spherical bodies --- src/blobs.cpp | 4 +--- src/world/Body.hpp | 4 ---- src/world/world.cpp | 11 +++-------- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/blobs.cpp b/src/blobs.cpp index 2072510..475c3fa 100644 --- a/src/blobs.cpp +++ b/src/blobs.cpp @@ -25,7 +25,7 @@ int main(int argc, char *argv[]) { sun.Radius(200.0); sun.Color(glm::dvec3(1.0)); sun.Luminosity(1.0e8); - sun.SurfaceTilt(glm::dvec2(PI * 0.25, PI * 0.25)); + sun.AxialTilt(glm::dvec2(PI * 0.25, PI * 0.25)); sun.AngularMomentum(1.0e18); world::Planet planet(25); @@ -33,7 +33,6 @@ int main(int argc, char *argv[]) { planet.SetParent(sun); planet.Mass(1.0e13); planet.GetOrbit().SemiMajorAxis(8184.0); - planet.SurfaceTilt(glm::dvec2(PI * 0.25, PI * 0.25)); planet.AxialTilt(glm::dvec2(PI * 0.127, 0.0)); planet.AngularMomentum(6.5e13); @@ -50,7 +49,6 @@ int main(int argc, char *argv[]) { second_planet.SetParent(sun); second_planet.Mass(1.0e12); second_planet.GetOrbit().SemiMajorAxis(4350.0); - second_planet.SurfaceTilt(glm::dvec2(PI * 0.125, PI * 0.25)); second_planet.AxialTilt(glm::dvec2(PI * 0.95, 0.0)); second_planet.AngularMomentum(1.0e12); diff --git a/src/world/Body.hpp b/src/world/Body.hpp index 6f85efd..1e32e6d 100644 --- a/src/world/Body.hpp +++ b/src/world/Body.hpp @@ -61,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; } @@ -123,7 +120,6 @@ private: double mass; double radius; Orbit orbit; - glm::dvec2 surface_tilt; glm::dvec2 axis_tilt; double rotation; double angular; diff --git a/src/world/world.cpp b/src/world/world.cpp index 525222f..596da07 100644 --- a/src/world/world.cpp +++ b/src/world/world.cpp @@ -42,7 +42,6 @@ Body::Body() , mass(1.0) , radius(1.0) , orbit() -, surface_tilt(0.0, 0.0) , axis_tilt(0.0, 0.0) , rotation(0.0) , angular(0.0) @@ -189,12 +188,8 @@ void Body::Cache() noexcept { orbital = glm::eulerAngleXY(axis_tilt.x, axis_tilt.y); inverse_orbital = glm::eulerAngleYX(-axis_tilt.y, -axis_tilt.x); } - local = - glm::eulerAngleY(rotation) - * glm::eulerAngleXY(surface_tilt.x, surface_tilt.y); - inverse_local = - glm::eulerAngleYX(-surface_tilt.y, -surface_tilt.x) - * glm::eulerAngleY(-rotation); + local = glm::eulerAngleY(rotation); + inverse_local = glm::eulerAngleY(-rotation); } void Body::CheckCollision() noexcept { @@ -606,7 +601,7 @@ void GenerateEarthlike(const Set &tiles, Planet &p) noexcept { constexpr double highland_thresh = 0.4; constexpr double mountain_thresh = 0.5; - const glm::dvec3 axis(glm::dvec4(0.0, 1.0, 0.0, 0.0) * glm::eulerAngleXY(p.SurfaceTilt().x, p.SurfaceTilt().y)); + const glm::dvec3 axis(0.0, 1.0, 0.0); const double cap_thresh = std::abs(std::cos(p.AxialTilt().x)); const double equ_thresh = std::abs(std::sin(p.AxialTilt().x)) / 2.0; const double fzone_start = equ_thresh - (equ_thresh - cap_thresh) / 3.0; -- 2.39.2