cgeoid.cpp 398 Bytes
Newer Older
Valentin Platzgummer's avatar
Valentin Platzgummer committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include "cgeoid.h"
#include "GeographicLib/Geoid.hpp"

extern "C"
double HeightAboveEllipsoid(double lat, double lon, double h) {
  try {
    // Declare static so that g is only constructed once
    static const GeographicLib::Geoid g("egm2008-1");
    return h + GeographicLib::Geoid::GEOIDTOELLIPSOID * g(lat, lon);
  }
  catch (...) {
    return GeographicLib::Math::NaN();
  }
}