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);