32 #include <boost/math/constants/constants.hpp> 37 #define NORM (FACTOR * RADIUS/2.0) 39 #define RADIUS 6378137.0 60 x = (tx * 2.0 / n - 1) *
NORM;
61 y = -(ty * 2.0 / n - 1) *
NORM;
76 tx = (int) (n * (1 + (x /
NORM)) / 2);
77 ty = (int) (n * (1 - (y /
NORM)) / 2);
89 double lon = p.
lon / 180.0 * boost::math::constants::pi<double>();
90 double lat = p.
lat / 180.0 * boost::math::constants::pi<double>();
91 x = lon / boost::math::constants::pi<double>() *
NORM;
92 y = log(tan(boost::math::constants::pi<double>() / 4.0 + lat / 2.0)) / boost::math::constants::pi<double>() *
NORM;
104 lon = p.
x /
NORM * 180.0;
105 lat = atan(sinh(p.
y /
NORM * boost::math::constants::pi<double>())) / boost::math::constants::pi<double>() * 180.0;
119 int S[] = { 1, 2, 4, 8, 16, 32 };
122 x = (x | (x << S[5])) & B[5];
123 x = (x | (x << S[4])) & B[4];
124 x = (x | (x << S[3])) & B[3];
125 x = (x | (x << S[2])) & B[2];
126 x = (x | (x << S[1])) & B[1];
127 x = (x | (x << S[0])) & B[0];
140 uint32_t x = p.
x - std::numeric_limits<coord_t>::min();
141 uint32_t y = p.
y - std::numeric_limits<coord_t>::min();
144 uint64_t mask = (1 << r) - 1;
146 uint32_t heven = x ^ y;
147 uint64_t notx = ~x & mask;
148 uint64_t noty = ~y & mask;
149 uint64_t temp = notx ^ y;
151 uint64_t v0 = 0, v1 = 0;
152 for (
int k = 1; k < r; k++) {
153 v1 = ((v1 & heven) | ((v0 ^ noty) & temp)) >> 1;
154 v0 = ((v0 & (v1 ^ notx)) | (~v0 & (v1 ^ noty))) >> 1;
156 hodd = (~v0 & (v1 ^ x)) | (v0 & (v1 ^ noty));