15 #if !defined(GEOGRAPHICLIB_DATA) 17 # define GEOGRAPHICLIB_DATA "C:/ProgramData/GeographicLib" 19 # define GEOGRAPHICLIB_DATA "/usr/local/share/GeographicLib" 23 #if !defined(GEOGRAPHICLIB_GEOID_DEFAULT_NAME) 24 # define GEOGRAPHICLIB_GEOID_DEFAULT_NAME "egm96-5" 29 # pragma warning (disable: 4996) 101 const int Geoid::c3_[stencilsize_ * nterms_] = {
102 9, -18, -88, 0, 96, 90, 0, 0, -60, -20,
103 -9, 18, 8, 0, -96, 30, 0, 0, 60, -20,
104 9, -88, -18, 90, 96, 0, -20, -60, 0, 0,
105 186, -42, -42, -150, -96, -150, 60, 60, 60, 60,
106 54, 162, -78, 30, -24, -90, -60, 60, -60, 60,
107 -9, -32, 18, 30, 24, 0, 20, -60, 0, 0,
108 -9, 8, 18, 30, -96, 0, -20, 60, 0, 0,
109 54, -78, 162, -90, -24, 30, 60, -60, 60, -60,
110 -54, 78, 78, 90, 144, 90, -60, -60, -60, -60,
111 9, -8, -18, -30, -24, 0, 20, 60, 0, 0,
112 -9, 18, -32, 0, 24, 30, 0, 0, -60, 20,
113 9, -18, -8, 0, -24, -30, 0, 0, 60, 20,
152 0, 0, -131, 0, 138, 144, 0, 0, -102, -31,
153 0, 0, 7, 0, -138, 42, 0, 0, 102, -31,
154 62, 0, -31, 0, 0, -62, 0, 0, 0, 31,
155 124, 0, -62, 0, 0, -124, 0, 0, 0, 62,
156 124, 0, -62, 0, 0, -124, 0, 0, 0, 62,
157 62, 0, -31, 0, 0, -62, 0, 0, 0, 31,
158 0, 0, 45, 0, -183, -9, 0, 93, 18, 0,
159 0, 0, 216, 0, 33, 87, 0, -93, 12, -93,
160 0, 0, 156, 0, 153, 99, 0, -93, -12, -93,
161 0, 0, -45, 0, -3, 9, 0, 93, -18, 0,
162 0, 0, -55, 0, 48, 42, 0, 0, -84, 31,
163 0, 0, -7, 0, -48, -42, 0, 0, 84, 31,
186 18, -36, -122, 0, 120, 135, 0, 0, -84, -31,
187 -18, 36, -2, 0, -120, 51, 0, 0, 84, -31,
188 36, -165, -27, 93, 147, -9, 0, -93, 18, 0,
189 210, 45, -111, -93, -57, -192, 0, 93, 12, 93,
190 162, 141, -75, -93, -129, -180, 0, 93, -12, 93,
191 -36, -21, 27, 93, 39, 9, 0, -93, -18, 0,
192 0, 0, 62, 0, 0, 31, 0, 0, 0, -31,
193 0, 0, 124, 0, 0, 62, 0, 0, 0, -62,
194 0, 0, 124, 0, 0, 62, 0, 0, 0, -62,
195 0, 0, 62, 0, 0, 31, 0, 0, 0, -31,
196 -18, 36, -64, 0, 66, 51, 0, 0, -102, 31,
197 18, -36, 2, 0, -66, -51, 0, 0, 102, 31,
212 "pixel_t has the wrong size");
220 if (!(getline(
_file, s) && s ==
"P5"))
227 while (getline(
_file, s)) {
232 string commentid,
key;
233 if (!(is >> commentid >> key) || commentid !=
"#")
235 if (key ==
"Description" || key ==
"DateTime") {
236 string::size_type
p =
237 s.find_first_not_of(
" \t",
unsigned(is.tellg()));
238 if (p != string::npos)
240 }
else if (key ==
"Offset") {
243 }
else if (key ==
"Scale") {
246 }
else if (key == (
_cubic ?
"MaxCubicError" :
"MaxBilinearError")) {
249 }
else if (key == (
_cubic ?
"RMSCubicError" :
"RMSBilinearError")) {
262 if (!(
_file >> maxval))
288 (
unsigned long long)(
_file.tellg()))
298 _file.exceptions(ifstream::eofbit | ifstream::failbit | ifstream::badbit);
322 real v00 = 0, v01 = 0, v10 = 0, v11 = 0;
328 v01 =
rawval(ix + 1, iy );
329 v10 =
rawval(ix , iy + 1);
330 v11 =
rawval(ix + 1, iy + 1);
334 v[k++] =
rawval(ix , iy - 1);
335 v[k++] =
rawval(ix + 1, iy - 1);
336 v[k++] =
rawval(ix - 1, iy );
337 v[k++] =
rawval(ix , iy );
338 v[k++] =
rawval(ix + 1, iy );
339 v[k++] =
rawval(ix + 2, iy );
340 v[k++] =
rawval(ix - 1, iy + 1);
341 v[k++] =
rawval(ix , iy + 1);
342 v[k++] =
rawval(ix + 1, iy + 1);
343 v[k++] =
rawval(ix + 2, iy + 1);
344 v[k++] =
rawval(ix , iy + 2);
345 v[k++] =
rawval(ix + 1, iy + 2);
352 t[
i] += v[
j] * c3x[nterms_ *
j +
i];
367 a = (1 -
fx) * v00 + fx * v01,
368 b = (1 - fx) * v10 + fx * v11,
369 c = (1 -
fy) * a + fy *
b,
381 real h = t[0] + fx * (t[1] + fx * (t[3] + fx * t[6])) +
382 fy * (t[2] + fx * (t[4] + fx * t[7]) +
383 fy * (t[5] + fx * t[8] + fy * t[9]));
402 catch (
const exception&) {
409 throw GeographicErr(
"Attempt to change cache of threadsafe Geoid");
435 if (ie - iw >=
_width - 1) {
451 for (
int iy =
min(oysize,
_ysize); iy--;)
454 catch (
const bad_alloc&) {
460 for (
int iy = in; iy <= is; ++iy) {
461 int iy1 = iy, iw1 = iw;
464 iy1 = iy1 < 0 ? -iy1 : 2 * (
_height - 1) - iy1;
471 Utility::readarray<pixel_t, pixel_t, true>
476 Utility::readarray<pixel_t, pixel_t, true>
477 (
_file, &(
_data[iy - in][xs1]), _xsize - xs1);
482 catch (
const exception&
e) {
484 throw GeographicErr(
string(
"Error filling cache ") + e.what());
490 char* geoidpath = getenv(
"GEOGRAPHICLIB_GEOID_PATH");
492 path = string(geoidpath);
495 char* datapath = getenv(
"GEOGRAPHICLIB_DATA");
497 path = string(datapath);
503 char* geoidname = getenv(
"GEOGRAPHICLIB_GEOID_NAME");
505 name = string(geoidname);
static T AngNormalize(T x)
const gtsam::Symbol key('X', 0)
#define GEOGRAPHICLIB_GEOID_DEFAULT_NAME
#define GEOGRAPHICLIB_DATA
Header for GeographicLib::Utility class.
static const int c3n_[stencilsize_ *nterms_]
static const unsigned nterms_
void CacheArea(real south, real west, real north, real east) const
static const int c3_[stencilsize_ *nterms_]
Mathematical functions needed by GeographicLib.
static std::string DefaultGeoidPath()
void filepos(int ix, int iy) const
EIGEN_DEVICE_FUNC const FloorReturnType floor() const
int EIGEN_BLAS_FUNC() swap(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
real height(real lat, real lon) const
real rawval(int ix, int iy) const
Array< int, Dynamic, 1 > v
Namespace for GeographicLib.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
static const unsigned pixel_max_
std::vector< std::vector< pixel_t > > _data
static const unsigned stencilsize_
Constants needed by GeographicLib
unsigned long long _swidth
Exception handling for GeographicLib.
static const int c3s_[stencilsize_ *nterms_]
static EIGEN_DEPRECATED const end_t end
static std::string DefaultGeoidName()
unsigned long long _datastart
static const unsigned pixel_size_
Jet< T, N > sqrt(const Jet< T, N > &f)
Annotation for function names.
int EIGEN_BLAS_FUNC() copy(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
Header for GeographicLib::Geoid class.