diff options
| author | Pierre Bourdon <delroth@gmail.com> | 2019-11-10 18:57:31 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-11-10 18:57:31 +0100 |
| commit | 066012b80d7a149779b4e910dcda3be8ec97f8e3 (patch) | |
| tree | 74b26d171f3a89a7f8bf0ee6c4d1bb84deea2442 /Source/Core/Common/Matrix.cpp | |
| parent | 499f065b836af6871e204614b030db36963e8198 (diff) | |
| parent | 8ef25ddd849eba0221180a968dac1b0bdd43bd98 (diff) | |
Merge pull request #8454 from jordan-woyak/motion-input-indicators
DolphinQt: Add accelerometer/gyroscope mapping indicators.
Diffstat (limited to 'Source/Core/Common/Matrix.cpp')
| -rw-r--r-- | Source/Core/Common/Matrix.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Source/Core/Common/Matrix.cpp b/Source/Core/Common/Matrix.cpp index 7efac12f78..9581a5a4ce 100644 --- a/Source/Core/Common/Matrix.cpp +++ b/Source/Core/Common/Matrix.cpp @@ -84,6 +84,23 @@ Matrix33 Matrix33::RotateZ(float rad) return mtx; } +Matrix33 Matrix33::Rotate(float rad, const Vec3& axis) +{ + const float s = std::sin(rad); + const float c = std::cos(rad); + Matrix33 mtx; + mtx.data[0] = axis.x * axis.x * (1 - c) + c; + mtx.data[1] = axis.x * axis.y * (1 - c) - axis.z * s; + mtx.data[2] = axis.x * axis.z * (1 - c) + axis.y * s; + mtx.data[3] = axis.y * axis.x * (1 - c) + axis.z * s; + mtx.data[4] = axis.y * axis.y * (1 - c) + c; + mtx.data[5] = axis.y * axis.z * (1 - c) - axis.x * s; + mtx.data[6] = axis.z * axis.x * (1 - c) - axis.y * s; + mtx.data[7] = axis.z * axis.y * (1 - c) + axis.x * s; + mtx.data[8] = axis.z * axis.z * (1 - c) + c; + return mtx; +} + Matrix33 Matrix33::Scale(const Vec3& vec) { Matrix33 mtx = {}; |
