Skip to content

Commit

Permalink
More accurate solution for planet diameter
Browse files Browse the repository at this point in the history
  • Loading branch information
gzotti committed Jan 22, 2023
1 parent e96d56a commit 71705db
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core/modules/Planet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


Expand Down
4 changes: 2 additions & 2 deletions src/core/modules/StarMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 71705db

Please sign in to comment.