1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-01-31 09:05:14 +01:00

Numerical instability fix

This commit is contained in:
Martin Tůma 2018-04-17 22:26:20 +02:00
parent e34800b8d1
commit c50e41dea1

View File

@ -8,6 +8,7 @@
#define TILE_SIZE 256 #define TILE_SIZE 256
#define EPSILON 1e-6
static QPointF ll2m(const Coordinates &c) static QPointF ll2m(const Coordinates &c)
{ {
@ -36,7 +37,7 @@ static qreal zoom2scale(int zoom)
static int scale2zoom(qreal scale) static int scale2zoom(qreal scale)
{ {
return (int)log2(360.0/(scale * (qreal)TILE_SIZE)); return (int)(log2(360.0/(scale * (qreal)TILE_SIZE)) + EPSILON);
} }