From 8acb0145f192632db6942e20504d99836f12fc6b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 6 Apr 2017 06:33:54 +0200 Subject: 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? --- tracker-steamvr/steamvr.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tracker-steamvr') 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() -- cgit v1.2.3