From 371182de78831aeab0174733d3687edeb78f5aa6 Mon Sep 17 00:00:00 2001 From: ion098 <146852218+ion098@users.noreply.github.com> Date: Thu, 28 Nov 2024 14:32:46 -0800 Subject: [PATCH] fix: :bug: Fix bug in Fisheye --- src/gamepad/joystick_transformation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gamepad/joystick_transformation.cpp b/src/gamepad/joystick_transformation.cpp index 18ec32a..225c2d1 100644 --- a/src/gamepad/joystick_transformation.cpp +++ b/src/gamepad/joystick_transformation.cpp @@ -35,8 +35,8 @@ std::pair Fisheye::get_value(std::pair value) { float j = std::sqrt(m_radius * m_radius - 1.0 * 1.0); if (x_abs >= j && y_abs >= j) { float theta = std::atan2(y_abs, x_abs); - x_abs *= std::acos(abs(std::remainder(theta, 90))); - y_abs *= std::acos(abs(std::remainder(theta, 90))); + x_abs *= m_radius / std::cos(abs(std::remainder(theta, 90))); + y_abs *= m_radius / std::cos(abs(std::remainder(theta, 90))); } x = std::copysign(std::min(1.0f, x_abs), x); y = std::copysign(std::min(1.0f, y_abs), y);