From fdcb7845cf08d4e0ae9a23f815c0fe1b7293b595 Mon Sep 17 00:00:00 2001 From: Orange Date: Wed, 1 Jul 2026 14:16:20 +0300 Subject: [PATCH] patch --- include/omath/algorithm/radar.hpp | 4 ++-- tests/general/unit_test_radar.cpp | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/include/omath/algorithm/radar.hpp b/include/omath/algorithm/radar.hpp index 69b9de9..3ca40df 100644 --- a/include/omath/algorithm/radar.hpp +++ b/include/omath/algorithm/radar.hpp @@ -10,7 +10,7 @@ namespace omath::algorithm template requires std::is_floating_point_v [[nodiscard]] - Vector3 world_to_radar(const Camera& camera, const Vector3& position, const FloatingType scale) + Vector2 world_to_radar(const Camera& camera, const Vector3& position, const FloatingType scale) { auto look_at_angles = camera.calc_look_at_angles(position); auto current_angles = camera.get_view_angles(); @@ -20,7 +20,7 @@ namespace omath::algorithm - current_angles.yaw + decltype(current_angles.yaw)::from_degrees(180); const auto right_scale = right_yaw.sin() < 0 ? -1.f : 1.f; - return omath::Vector3(static_cast(yaw.sin()) * right_scale, yaw.cos(), 0.f) + return omath::Vector2(static_cast(yaw.sin()) * right_scale, yaw.cos()) * (camera.get_origin().distance_to(position) * scale); } } // namespace omath::algorithm diff --git a/tests/general/unit_test_radar.cpp b/tests/general/unit_test_radar.cpp index ea22b42..4b75080 100644 --- a/tests/general/unit_test_radar.cpp +++ b/tests/general/unit_test_radar.cpp @@ -29,14 +29,12 @@ static void verify_world_to_radar_uses_engine_world_axes(const Vector3 @@ -62,14 +60,12 @@ static void verify_world_to_radar_uses_changed_camera_yaw(const float yaw_degree EXPECT_NEAR(forward_radar.x, 0.f, 1e-4f); EXPECT_NEAR(forward_radar.y, -radar_distance, 1e-4f); - EXPECT_NEAR(forward_radar.z, 0.f, 1e-6f); const auto left_position = origin + world_forward * world_distance; const auto left_radar = algorithm::world_to_radar(camera, left_position, scale); EXPECT_NEAR(left_radar.x, -radar_distance, 1e-4f); EXPECT_NEAR(left_radar.y, 0.f, 1e-4f); - EXPECT_NEAR(left_radar.z, 0.f, 1e-6f); } template @@ -93,7 +89,6 @@ static void verify_world_to_radar_ignores_camera_pitch(const Vector3