Skip to content

Commit

Permalink
make translation more sensitive, sacrifice rotation for usability (TBD)
Browse files Browse the repository at this point in the history
  • Loading branch information
henrykrumb committed Jul 6, 2023
1 parent a297c02 commit 4552b84
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/spnavigt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <csignal>
#include <cmath>


#include <CLI/App.hpp>
#include <CLI/Formatter.hpp>
#include <CLI/Config.hpp>
Expand Down Expand Up @@ -56,7 +55,7 @@ QuadMatrix<4> rotmatZ(float angle)
return QuadMatrix<4>(arr);
}

int main(int argc, char* argv[])
int main(int argc, char *argv[])
{
spnav_event sev;

Expand Down Expand Up @@ -101,19 +100,20 @@ int main(int argc, char* argv[])
{
if (sev.type == SPNAV_EVENT_MOTION)
{
T.set(0, 3, (float)-sev.motion.x);
T.set(2, 3, (float)sev.motion.y);
T.set(1, 3, (float)-sev.motion.z);
Rx = rotmatX(sev.motion.rx);
Ry = rotmatY(sev.motion.rz);
Rz = rotmatZ(sev.motion.ry);
T.set(0, 3, T.get(0, 3) + (float)-sev.motion.x * 0.01);
T.set(2, 3, T.get(2, 3) + (float)sev.motion.y * 0.01);
T.set(1, 3, T.get(1, 3) + (float)-sev.motion.z * 0.01);
//Rx = rotmatX(sev.motion.rx);
//Ry = rotmatY(sev.motion.rz);
//Rz = rotmatZ(sev.motion.ry);

printf("got motion event: t(%d, %d, %d) ", sev.motion.x, sev.motion.y, sev.motion.z);
printf("r(%d, %d, %d)\n", sev.motion.rx, sev.motion.ry, sev.motion.rz);
dirty = true;
}
else if (sev.type == SPNAV_EVENT_BUTTON)
{
T.identity();
printf("got button %s event b(%d)\n", sev.button.press ? "press" : "release", sev.button.bnum);
}
}
Expand Down

0 comments on commit 4552b84

Please sign in to comment.