diff options
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp')
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp b/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp index 2852291021..8b8a22e400 100644 --- a/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp +++ b/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp @@ -5,6 +5,7 @@ #include <algorithm> #include <chrono> +#include <cmath> #include <ranges> #include <string> #include <vector> @@ -277,6 +278,16 @@ bool CalibrationBuilder::IsCalibrationDataSensible() const return stats.StandardDeviation() < REASONABLE_DEVIATION; } +bool CalibrationBuilder::IsComplete() const +{ + if (!IsCalibrationDataSensible()) + return false; + + const auto half_calibration = + 0.5 * GetCalibrationRadiusAtAngle(std::atan2(m_prev_point.y, m_prev_point.x) + MathUtil::TAU); + return m_prev_point.LengthSquared() < (half_calibration * half_calibration); +} + ControlState CalibrationBuilder::GetCalibrationRadiusAtAngle(double angle) const { return ControllerEmu::ReshapableInput::GetCalibrationDataRadiusAtAngle(m_calibration_data, angle); |
