summaryrefslogtreecommitdiffhomepage
path: root/facetracknoir
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2013-06-30 15:47:07 +0200
committerStanislaw Halik <sthalik@misaki.pl>2013-06-30 15:47:07 +0200
commit8f06f99d2f79ed9559dc8928d3bd1c70557a1b8b (patch)
treeeff2fba91c6cf1ee2513b43f66411ca9af51de88 /facetracknoir
parent57b7ab86107540ec77f17dc9a420d82a6e4b7faa (diff)
parentd4549fb4c80f9ebdafe0d52db071f3ee3a4c225a (diff)
Merge branch 'master' of github.com:opentrack/opentrack
Conflicts: facetracknoir/rotation.h
Diffstat (limited to 'facetracknoir')
-rw-r--r--facetracknoir/main.cpp3
-rw-r--r--facetracknoir/rotation.h15
-rw-r--r--facetracknoir/tracker.cpp2
3 files changed, 12 insertions, 8 deletions
diff --git a/facetracknoir/main.cpp b/facetracknoir/main.cpp
index 01b9d8ea..8ba437bf 100644
--- a/facetracknoir/main.cpp
+++ b/facetracknoir/main.cpp
@@ -40,6 +40,9 @@
#endif
int main(int argc, char** argv)
{
+#if defined(_WIN32)
+ (void) timeBeginPeriod(1);
+#endif
QApplication app(argc, argv);
QFont font;
font.setFamily(font.defaultFamily());
diff --git a/facetracknoir/rotation.h b/facetracknoir/rotation.h
index a1500969..5385b545 100644
--- a/facetracknoir/rotation.h
+++ b/facetracknoir/rotation.h
@@ -17,7 +17,7 @@ public:
Rotation(double a, double b, double c, double d) : a(a),b(b),c(c),d(d) {}
Rotation inv(){ // inverse
- return Rotation(a,-b,-c,-d);
+ return Rotation(a,-b,-c, -d);
}
@@ -25,6 +25,7 @@ public:
// see http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles
void fromEuler(double yaw, double pitch, double roll)
{
+
double sin_phi = sin(roll/2.0);
double cos_phi = cos(roll/2.0);
double sin_the = sin(pitch/2.0);
@@ -38,7 +39,7 @@ public:
d = cos_phi*cos_the*sin_psi - sin_phi*sin_the*cos_psi;
}
- void toEuler(double& yaw, double& pitch, double& roll)
+ void Rotation::toEuler(double& yaw, double& pitch, double& roll)
{
roll = atan2(2.0*(a*b + c*d), 1.0 - 2.0*(b*b + c*c));
pitch = asin(2.0*(a*c - b*d));
@@ -47,17 +48,17 @@ public:
/* const Rotation operator*(const Rotation& A, const Rotation& B)
{
- return Rotation(A.a*B.a - A.b*B.b - A.c*B.c - A.d*B.d, // quaternion multiplication
- A.a*B.b + A.b*B.a + A.c*B.d - A.d*B.c,
- A.a*B.c - A.b*B.d + A.c*B.a + A.d*B.b,
- A.a*B.d + A.b*B.c - A.c*B.b + A.d*B.a);
+ return Rotation(A.w*B.w - A.x*B.x - A.y*B.y - A.z*B.z, // quaternion multiplication
+ A.w*B.x + A.x*B.w + A.y*B.z - A.z*B.y,
+ A.w*B.y - A.x*B.z + A.y*B.w + A.z*B.x,
+ A.w*B.z + A.x*B.y - A.y*B.x + A.z*B.w);
}*/
const Rotation operator*(const Rotation& B)
{
const Rotation& A = *this;
- return Rotation(A.a*B.a - A.b*B.b - A.c*B.c - A.d*B.d, // quaternion multiplication
+return Rotation(A.a*B.a - A.b*B.b - A.c*B.c - A.d*B.d, // quaternion multiplication
A.a*B.b + A.b*B.a + A.c*B.d - A.d*B.c,
A.a*B.c - A.b*B.d + A.c*B.a + A.d*B.b,
A.a*B.d + A.b*B.c - A.c*B.b + A.d*B.a);
diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp
index 25e09126..e34bf25e 100644
--- a/facetracknoir/tracker.cpp
+++ b/facetracknoir/tracker.cpp
@@ -200,7 +200,7 @@ void Tracker::run() {
}
//for lower cpu load
- usleep(1000);
+ msleep(1);
}
for (int i = 0; i < 6; i++)