diff options
-rw-r--r-- | game/geoData.cpp | 4 | ||||
-rw-r--r-- | test/test-geoData.cpp | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/game/geoData.cpp b/game/geoData.cpp index 78f753f..781b41e 100644 --- a/game/geoData.cpp +++ b/game/geoData.cpp @@ -25,8 +25,8 @@ GeoData::loadFromAsciiGrid(const std::filesystem::path & input) vertices.reserve(ncols * nrows); GeoData mesh; mesh.lowerExtent = {xllcorner, yllcorner, std::numeric_limits<float>::max()}; - mesh.upperExtent - = {xllcorner + (cellsize * ncols), yllcorner + (cellsize * nrows), std::numeric_limits<float>::min()}; + mesh.upperExtent = {xllcorner + (cellsize * (ncols - 1)), yllcorner + (cellsize * (nrows - 1)), + std::numeric_limits<float>::min()}; for (size_t row = 0; row < nrows; ++row) { for (size_t col = 0; col < ncols; ++col) { float height = 0; diff --git a/test/test-geoData.cpp b/test/test-geoData.cpp index 34c9cb6..2ea9b26 100644 --- a/test/test-geoData.cpp +++ b/test/test-geoData.cpp @@ -21,7 +21,7 @@ BOOST_AUTO_TEST_CASE(loadSuccess) BOOST_CHECK_EQUAL(2 * (ncols - 1) * (nrows - 1), n_faces()); const auto [lower, upper] = getExtents(); BOOST_CHECK_EQUAL(lower, glm::vec3(310000, 490000, -2.6)); - BOOST_CHECK_EQUAL(upper, glm::vec3(320000, 500000, 571.6)); + BOOST_CHECK_EQUAL(upper, glm::vec3(319950, 499950, 571.6)); } BOOST_AUTO_TEST_CASE(normalsAllPointUp) |