Precise Rotation (#482)

* temporarily disabled adjust chaperone

* added experimental check to prevent rotation drift

* adjusted ss to 2 digits precision

* updated rotation model to be based on relative position and not drift

* fixed force precision error with supersampling

* added Error for turning too fast

* removed error impossible to execute

* fixed and cleaned up some potential failure points

* added inversion check

* re-worded warning

* added adjustchaperone2 defaulted to off to replace adjust chaperone

* moved adjust chaperone to settings removed from offsets tab

* moved adjust chaperone to settings removed from offsets tab

* enabled clipping for settings page no longer scrolls outside of its area

* updated strings for release
This commit is contained in:
ykeara
2020-07-11 12:26:56 -05:00
committed by GitHub
parent b12f5f8b34
commit 549f65dc32
10 changed files with 164 additions and 79 deletions
+31 -1
View File
@@ -1,7 +1,7 @@
#pragma once
#include <openvr.h>
//#include <cmath>
#include <cmath>
namespace quaternion
{
@@ -65,4 +65,34 @@ inline double getYaw( const vr::HmdQuaternion_t& quat )
return yawResult;
}
inline double getPitch( const vr::HmdQuaternion_t& quat )
{
// positive forward
// negative behind
double pitchResult
= atan2( 2.0 * ( quat.x * quat.w + quat.y * quat.z ),
1.0 - 2.0 * ( quat.x * quat.x + quat.y * quat.y ) );
// double pitchResult
//= atan2( 2.0 * ( quat.x * quat.w + quat.y * quat.z ),
// 2.0 * ( quat.w * quat.w + quat.z * quat.z ) - 1.0 );
return pitchResult;
}
inline double getRoll( const vr::HmdQuaternion_t& quat )
{
double rollResult;
double sinp = 2 * ( quat.w * quat.z - quat.y * quat.x );
if ( std::abs( sinp ) >= 1 )
{
rollResult = std::copysign( 3.14159265358979323846 / 2, sinp );
}
else
{
rollResult = std::asin( sinp );
}
return rollResult;
}
} // namespace quaternion