From 69f46abce1d5affde35d52cf6ef4d22df1bdab1b Mon Sep 17 00:00:00 2001 From: Orange Date: Tue, 9 Sep 2025 01:37:38 +0300 Subject: [PATCH] Adds projection test for world-to-screen consistency Adds a test to verify the consistency of world-to-screen and screen-to-world projections. This ensures that projecting a point from world to screen and back results in the same point, thereby validating the correctness of the camera projection transformations. --- tests/general/unit_test_projection.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/general/unit_test_projection.cpp b/tests/general/unit_test_projection.cpp index 8d55d1a..03c5e42 100644 --- a/tests/general/unit_test_projection.cpp +++ b/tests/general/unit_test_projection.cpp @@ -16,6 +16,9 @@ TEST(UnitTestProjection, Projection) const auto projected = cam.world_to_screen({1000, 0, 50.f}); const auto result = cam.screen_to_world(projected.value()); const auto result2 = cam.world_to_screen(result.value()); + + EXPECT_EQ(static_cast>(projected.value()), + static_cast>(result2.value())); EXPECT_NEAR(projected->x, 960.f, 0.001f); EXPECT_NEAR(projected->y, 504.f, 0.001f); EXPECT_NEAR(projected->z, 1.f, 0.001f);