23 +
"d not in [-90d, 90d]");
30 prec =
max(0,
min(
int(maxprec_), prec));
34 ilon = x * mult1_ / m_,
35 ilat = y * mult1_ / m_;
36 x -= ilon * m_ / mult1_; y -= ilat * m_ / mult1_;
39 for (
int c = lonlen_;
c--;) {
40 gars1[
c] = digits_[ ilon % baselon_]; ilon /= baselon_;
42 for (
int c = latlen_;
c--;) {
43 gars1[lonlen_ +
c] = letters_[ilat % baselat_]; ilat /= baselat_;
46 ilon = x / mult3_; ilat = y / mult3_;
47 gars1[baselen_] = digits_[mult2_ * (mult2_ - 1 - ilat) + ilon + 1];
49 ilon = x % mult3_; ilat = y % mult3_;
50 gars1[baselen_ + 1] = digits_[mult3_ * (mult3_ - 1 - ilat) + ilon + 1];
53 gars.resize(baselen_ + prec);
54 copy(gars1, gars1 + baselen_ + prec, gars.begin());
58 int& prec,
bool centerp) {
59 int len =
int(gars.length());
61 toupper(gars[0]) ==
'I' &&
62 toupper(gars[1]) ==
'N' &&
63 toupper(gars[2]) ==
'V') {
68 throw GeographicErr(
"GARS must have at least 5 characters " + gars);
70 throw GeographicErr(
"GARS can have at most 7 characters " + gars);
71 int prec1 = len - baselen_;
73 for (
int c = 0;
c < lonlen_; ++
c) {
77 ilon = ilon * baselon_ + k;
79 if (!(ilon >= 1 && ilon <= 720))
80 throw GeographicErr(
"Initial digits in GARS must lie in [1, 720] " +
84 for (
int c = 0;
c < latlen_; ++
c) {
87 throw GeographicErr(
"Illegal letters in GARS " + gars.substr(3,2));
88 ilat = ilat * baselat_ + k;
91 throw GeographicErr(
"GARS letters must lie in [AA, QZ] " + gars);
94 lat1 = ilat + latorig_ * unit,
95 lon1 = ilon + lonorig_ * unit;
98 if (!(k >= 1 && k <= mult2_ * mult2_))
99 throw GeographicErr(
"6th character in GARS must [1, 4] " + gars);
102 lat1 = mult2_ * lat1 + (mult2_ - 1 - k / mult2_);
103 lon1 = mult2_ * lon1 + (k % mult2_);
107 throw GeographicErr(
"7th character in GARS must [1, 9] " + gars);
110 lat1 = mult3_ * lat1 + (mult3_ - 1 - k / mult3_);
111 lon1 = mult3_ * lon1 + (k % mult3_);
115 unit *= 2; lat1 = 2 * lat1 + 1; lon1 = 2 * lon1 + 1;
static T AngNormalize(T x)
Header for GeographicLib::Utility class.
static void Forward(real lat, real lon, int prec, std::string &gars)
EIGEN_DEVICE_FUNC const FloorReturnType floor() const
static void Reverse(const std::string &gars, real &lat, real &lon, int &prec, bool centerp=true)
Namespace for GeographicLib.
static const char *const letters_
static std::string str(T x, int p=-1)
static const char *const digits_
Exception handling for GeographicLib.
static int lookup(const std::string &s, char c)
int EIGEN_BLAS_FUNC() copy(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
Header for GeographicLib::GARS class.
size_t len(handle h)
Get the length of a Python object.
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x