Another patch - Galactic distances

The place to discuss creating, porting and modifying Celestia's source code.
Topic author
chenyu

Another patch - Galactic distances

Post #1by chenyu » 12.05.2002, 04:39

This patch changes the overlay code to list the distances in Kpc and
Mpc which makes it easier to handle galaxies


--- celestiacore.cpp.orig 2002-05-11 23:12:42.000000000 -0500
+++ celestiacore.cpp 2002-05-11 23:20:59.000000000 -0500
@@ -1023,7 +1023,13 @@

static void displayDistance(Overlay& overlay, double distance)
{
- if (abs(distance) >= astro::AUtoLightYears(1000.0f))
+ if (abs(distance) >= astro::parsecsToLightYears(1e+6f))
+ overlay.printf("%.3f Mpc", astro::lightYearsToParsecs(distance) /
+ 1e+6f);
+ else if (abs(distance) >= astro::parsecsToLightYears(1e+3f))
+ overlay.printf("%.3f Kpc", astro::lightYearsToParsecs(distance) /
+ 1e+3f);
+ else if (abs(distance) >= astro::AUtoLightYears(1000.0f))
overlay.printf("%.3f ly", distance);
else if (abs(distance) >= astro::kilometersToLightYears(10000000.0))
overlay.printf("%.3f au", astro::lightYearsToAU(distance));

Return to “Development”