Skip to content

Commit

Permalink
Displaying triaxial radii, attempt CelestiaProject#1
Browse files Browse the repository at this point in the history
For spherical or mesh objects,
Radius: [radius]

For spheroids or ellipsoids,
Radius: [mean] ([a] × [b] × [c])
  • Loading branch information
JiliTheSpaceboy authored May 30, 2024
1 parent 5864b12 commit 653bd31
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/celestia/hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,25 @@ displayPlanetInfo(const util::NumberFormatter& formatter,
{
return;
}

overlay.printf(_("Radius: %s\n"),
DistanceKmToStr(formatter, body.getRadius(), 5, hudSettings.measurementSystem));
else if (body.isSphere() || !body.isEllipsoid())
{
overlay.print(_("Radius: {}\n"),
DistanceKmToStr(formatter, body.getRadius(), 5, hudSettings.measurementSystem));
}
else // show mean radius along with triaxial semi-axes
{
double radiusMean = cbrt(semiAxes.prod());
double axis0 = semiAxes[0];
double axis1 = semiAxes[1];
double axis2 = semiAxes[2];
overlay.print(_("Radius: {} ({} × {} × {})\n"),
DistanceKmToStr(formatter, radiusMean, 5, hudSettings.measurementSystem),
DistanceKmToStr(formatter, axis0, 5, hudSettings.measurementSystem),
DistanceKmToStr(formatter, axis1, 5, hudSettings.measurementSystem),
DistanceKmToStr(formatter, axis2, 5, hudSettings.measurementSystem));
}
// overlay.printf(_("Radius: %s\n"),
// DistanceKmToStr(formatter, body.getRadius(), 5, hudSettings.measurementSystem));

displayApparentDiameter(overlay, body.getRadius(), distanceKm, loc);

Expand Down

0 comments on commit 653bd31

Please sign in to comment.