CelestiaProject / Celestia

Real-time 3D visualization of space.

Home Page:https://celestiaproject.space

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invliad distance to planet calculation

375gnu opened this issue · comments

Describe the bug

void
displayPlanetInfo(Overlay& overlay,
                  int detail,
                  Body& body,
                  double t,
                  const Eigen::Vector3d& viewVec,
                  const HudSettings& hudSettings)
{
    double distanceKm = viewVec.norm();
    double distance = distanceKm - body.getRadius();

So this calculation assumes that the planet is a sphere. When close to the surface of oblate bodies this can give negative values. We should take into account actual semiaxes.