Skip to content

Commit

Permalink
Fix pixel coordinate to tile coordinate conversion
Browse files Browse the repository at this point in the history
This addresses issue geo-data#9. Although this does not appear to be an issue on Linux
for some reason, it affected a Windows build and the logic appears sound e.g `50
/ 100` correctly resolves to tile `0` whereas `ceil(50.0 / 100)` resolves to
tile `1`.
  • Loading branch information
Homme Zwaagstra committed Nov 17, 2014
1 parent bb9ea94 commit cebf0b9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Grid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ class ctb::Grid {
/// Get the tile covering a pixel location
inline TilePoint
pixelsToTile(const PixelPoint &pixel) const {
i_tile tx = (i_tile) ceil(pixel.x / mTileSize),
ty = (i_tile) ceil(pixel.y / mTileSize);
i_tile tx = (i_tile) (pixel.x / mTileSize),
ty = (i_tile) (pixel.y / mTileSize);

return TilePoint(tx, ty);
}
Expand Down

0 comments on commit cebf0b9

Please sign in to comment.