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.
This commit is contained in:
2025-09-09 01:37:38 +03:00
parent de61f7a5d8
commit 69f46abce1

View File

@@ -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<omath::Vector2<float>>(projected.value()),
static_cast<omath::Vector2<float>>(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);