Round coordinates in low-zoom grid instead of truncating

To avoid rounding error if features are already tile-grid-aligned
This commit is contained in:
Eric Fischer
2016-11-29 15:18:44 -08:00
parent ab9eafa0b7
commit f6d5d1803b
4 changed files with 995 additions and 980 deletions
+3 -2
View File
@@ -1302,10 +1302,11 @@ static int clip(double *x0, double *y0, double *x1, double *y1, double xmin, dou
drawvec stairstep(drawvec &geom, int z, int detail) {
drawvec out;
double scale = 1 << (32 - detail - z);
for (size_t i = 0; i < geom.size(); i++) {
geom[i].x >>= (32 - detail - z);
geom[i].y >>= (32 - detail - z);
geom[i].x = std::round(geom[i].x / scale);
geom[i].y = std::round(geom[i].y / scale);
}
for (size_t i = 0; i < geom.size(); i++) {