diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2017-04-06 06:33:54 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-04-06 06:33:54 +0200 |
commit | 8acb0145f192632db6942e20504d99836f12fc6b (patch) | |
tree | fb3ec974f82029ce1a10d3f0a4367e046f89128b | |
parent | 086fc2d81a68fe70c5897fbe6a1db0e1ba6df4cd (diff) |
tracker/steamvr: return more precise radian result
While atan2's input is limited to single-float precision, extend
result precision to double-float precision. The result's in
radians. Why didn't gradians get popular?
-rw-r--r-- | tracker-steamvr/steamvr.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tracker-steamvr/steamvr.cpp b/tracker-steamvr/steamvr.cpp index 2552be56..0fc07afc 100644 --- a/tracker-steamvr/steamvr.cpp +++ b/tracker-steamvr/steamvr.cpp @@ -260,9 +260,9 @@ void steamvr::matrix_to_euler(double& yaw, double& pitch, double& roll, const vr using std::atan2; using std::asin; - yaw = atan2(result.m[2][0], result.m[0][0]); - pitch = atan2(result.m[1][1], result.m[1][2]); - roll = asin(result.m[1][0]); + yaw = atan2(double(result.m[2][0]), double(result.m[0][0])); + pitch = atan2(double(result.m[1][1]), double(result.m[1][2])); + roll = asin(double(result.m[1][0])); } steamvr_dialog::steamvr_dialog() |