diff --git a/src/core/modules/Planet.cpp b/src/core/modules/Planet.cpp index b4fb68ff24c6c..e387041e7a47f 100644 --- a/src/core/modules/Planet.cpp +++ b/src/core/modules/Planet.cpp @@ -2865,7 +2865,7 @@ float Planet::getVMagnitude(const StelCore* core) const double Planet::getAngularRadius(const StelCore* core) const { const double rad = (rings ? rings->getSize() : equatorialRadius); - return std::atan2(rad*sphereScale,getJ2000EquatorialPos(core).norm()) * M_180_PI; + return std::asin(rad*sphereScale/getJ2000EquatorialPos(core).norm()) * M_180_PI; } diff --git a/src/core/modules/StarMgr.cpp b/src/core/modules/StarMgr.cpp index 1798135abcb9e..ff5fef45f7ccd 100644 --- a/src/core/modules/StarMgr.cpp +++ b/src/core/modules/StarMgr.cpp @@ -1319,10 +1319,10 @@ void StarMgr::draw(StelCore* core) PlanetP moon = GETSTELMODULE(SolarSystem)->getMoon(); Vec3d moonPos=moon->getJ2000EquatorialPos(core); const double moonRadius = moon->getEquatorialRadius() * moon->getSphereScale(); - double angularSize = atan2(moonRadius, moonPos.norm()); + double angularSize = asin(moonRadius / moonPos.norm()); moonPos.normalize(); SphericalCap moonCap(moonPos, cos(angularSize)); - for (auto cap : viewportCaps) + for (auto &cap : viewportCaps) { if (cap.intersects(moonCap)) filterMoon=true;