[glfw] Fix random point generation

This commit is contained in:
Bruno de Oliveira Abinader
2016-03-31 16:22:41 +03:00
parent 77b0723476
commit 01a0f5464d

View File

@@ -211,13 +211,9 @@ void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action,
}
mbgl::LatLng GLFWView::makeRandomPoint() const {
const auto nw = map->latLngForPixel({ 0, 0 });
const auto se = map->latLngForPixel({ double(width), double(height) });
const double lon = nw.longitude + (se.longitude - nw.longitude) * (double(std::rand()) / RAND_MAX);
const double lat = se.latitude + (nw.latitude - se.latitude) * (double(std::rand()) / RAND_MAX);
return { lat, lon };
const double x = width * double(std::rand()) / RAND_MAX;
const double y = height * double(std::rand()) / RAND_MAX;
return map->latLngForPixel({ x, y });
}
std::shared_ptr<const mbgl::SpriteImage>