Skip to content

Commit

Permalink
fix: 🐛 Fix bug in Fisheye
Browse files Browse the repository at this point in the history
  • Loading branch information
ion098 committed Nov 28, 2024
1 parent 1c07cd3 commit 371182d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/gamepad/joystick_transformation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ std::pair<float, float> Fisheye::get_value(std::pair<float, float> 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);
Expand Down

0 comments on commit 371182d

Please sign in to comment.