29 #include "../../../../shared/api/physical_constants.h"
53 return Point((
int) (p.X() /
TileSize().Width()), (
int) (p.Y() /
TileSize().Height()));
66 return Size(sMax.Width() - sMin.Width() + 1, sMax.Height() - sMin.Height() + 1);
71 return (s.Width() * s.Height());
76 return Size(s.Width() *
TileSize().Width(), s.Height() *
TileSize().Height());
85 for(
int x = (topLeft.X() - padding);
x <= (rightBottom.X() + padding);
x++)
87 for(
int y = (topLeft.Y() - padding);
y <= (rightBottom.Y() + padding);
y++)
89 Point p = Point(
x,
y);
90 if(!ret.contains(p) && p.X() >= 0 && p.Y() >= 0)
128 if(((qlonglong) qAbs(x /
PI)) < 2)
139 x = x - (((qlonglong) (x / (
MAXLONG * TWO_PI))) * (TWO_PI *
MAXLONG));
144 x = x - (((qlonglong) (x / (
DBLLONG * TWO_PI))) * (TWO_PI *
DBLLONG));
163 return (1.0 - 0.25 * x * (1.0 + x / 16.0 * (3.0 + 1.25 * x)));
168 return (0.375 * x * (1.0 + 0.25 * x * (1.0 + 0.46875 * x)));
173 return (0.05859375 * x * x * (1.0 + 0.75 * x));
178 return (x * x * x * (35.0 / 3072.0));
181 double PureProjection::mlfn(
const double &e0,
const double &e1,
const double &e2,
const double &e3,
const double &phi)
183 return (e0 * phi - e1 * sin(2.0 * phi) + e2 * sin(4.0 * phi) - e3 * sin(6.0 * phi));
188 return ((qlonglong) (((lon + 180.0) / 6.0) + 1.0));
203 double Lat_R = Lat_D *
DEG2RAD;
204 double Lng_R = Lng_D *
DEG2RAD;
207 double ee = 1.0 - (B /
Axis()) * (B /
Axis());
208 double N = (
Axis() / sqrt(1.0 - ee * sin(Lat_R) * sin(Lat_R)));
210 X = (N + Height) * cos(Lat_R) * cos(Lng_R);
211 Y = (N + Height) * cos(Lat_R) * sin(Lng_R);
212 Z = (N * (B /
Axis()) * (B /
Axis()) + Height) * sin(Lat_R);
217 double Lng_R = atan2(Y, X);
219 double P = sqrt(X * X + Y * Y);
220 double Theta = atan2(Z, (P * (1.0 -
Flattening())));
221 double st = sin(Theta);
222 double ct = cos(Theta);
223 double Lat_R = atan2(Z + E / (1.0 -
Flattening()) *
Axis() * st * st * st, P - E *
Axis() * ct * ct * ct);
236 return TWO_PI - myfmod(atan2(sin(lon1_R - lon2_R) * cos(lat2_R),
237 cos(lat1_R) * sin(lat2_R) - sin(lat1_R) * cos(lat2_R) * cos(lon1_R - lon2_R)),
TWO_PI);
248 double R = WGS84_RADIUS_EARTH_KM;
253 double dLat_R = (lat2_R-lat1_R);
254 double dLon_R = (lon2_R-lon1_R);
255 double a = sin(dLat_R/2) * sin(dLat_R/2) + cos(lat1_R) * cos(lat2_R) * sin(dLon_R/2) * sin(dLon_R/2);
256 double c = 2 * atan2(sqrt(a), sqrt(1-a));
281 double PureProjection::myfmod(
double x,
double y)
283 return x - y*floor(x/y);
294 double lat2_R = asin(sin(lat1_R) * cos(d/R) + cos(lat1_R) * sin(d/R) * cos(tc) );
295 double lon2_R = lon1_R + atan2(sin(tc) * sin(d/R) * cos(lat1_R),
296 cos(d/R) - sin(lat1_R) * sin(lat2_R));
299 ret.
SetLng(lon2_R * RAD2DEG);
312 return qMin(qMax(val, minValue), maxValue);