diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-11-03 20:12:03 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-11-03 20:12:03 +0000 |
commit | 3931bda936aba6ddae26c1d9f1d450781df800e8 (patch) | |
tree | c66bb3e540354baa2e45a782d8ae1f012be33a96 /test/test-terrain.cpp | |
parent | Helper to get cartesian position from baricentric on Triangle (diff) | |
download | ilt-3931bda936aba6ddae26c1d9f1d450781df800e8.tar.bz2 ilt-3931bda936aba6ddae26c1d9f1d450781df800e8.tar.xz ilt-3931bda936aba6ddae26c1d9f1d450781df800e8.zip |
Implement terrain intersect ray
Diffstat (limited to 'test/test-terrain.cpp')
-rw-r--r-- | test/test-terrain.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/test-terrain.cpp b/test/test-terrain.cpp index 38cb51f..53eebfb 100644 --- a/test/test-terrain.cpp +++ b/test/test-terrain.cpp @@ -104,6 +104,18 @@ BOOST_DATA_TEST_CASE(findPositionAt, BOOST_CHECK_CLOSE_VEC(fixedTerrtain.positionAt(p), p ^ h); } +using FindRayIntersectData = std::tuple<glm::vec3, glm::vec3, glm::vec3>; + +BOOST_DATA_TEST_CASE(findRayIntersect, + boost::unit_test::data::make<FindRayIntersectData>({ + {{310000, 490000, 50}, {1, 1, -2}, {310008.59, 490008.59, 32.834301}}, + {{310000, 490000, 50}, {1, 1, -1}, {310017.12, 490017.12, 32.868526}}, + }), + p, d, i) +{ + BOOST_CHECK_CLOSE_VEC(fixedTerrtain.intersectRay({p, d}).value(), i); +} + using WalkTerrainData = std::tuple<glm::vec2, glm::vec2, std::vector<int>>; BOOST_DATA_TEST_CASE(walkTerrain, |