summaryrefslogtreecommitdiffhomepage
path: root/tracker-test
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-01-16 19:15:02 +0100
committerStanislaw Halik <sthalik@misaki.pl>2017-01-16 19:15:02 +0100
commit3094ef1089e117ca22c2ac1acc94698d240d28fe (patch)
tree3bea0c56d0901988b008be2d5f485d10bc6550ee /tracker-test
parent734d02b3642807d6edeb26c5aff5162a9eaff77e (diff)
tracker/test: test continuous step from -180 to +180
Diffstat (limited to 'tracker-test')
-rw-r--r--tracker-test/test.cpp18
-rw-r--r--tracker-test/test.h3
2 files changed, 8 insertions, 13 deletions
diff --git a/tracker-test/test.cpp b/tracker-test/test.cpp
index 78c72178..06a4f1f2 100644
--- a/tracker-test/test.cpp
+++ b/tracker-test/test.cpp
@@ -56,23 +56,21 @@ void test_tracker::data(double *data)
#endif
for (int i = 0; i < 6; i++)
{
- double x = fmod(last_x[i] + incr[i] * d2r * dt, 2 * M_PI);
+ double x = last_x[i] + incr[i] * dt;
+ if (x > 180)
+ x = -360 + x;
+ else if (x < -180)
+ x = 360 + x;
+ x = copysign(fmod(fabs(x), 360), x);
last_x[i] = x;
if (i >= 3)
{
-#ifdef DISCONTINUITY
- if (x > pi + pi/2)
- x -= M_PI;
- else if (x > pi/2 && x < pi)
- x += M_PI;
-#endif
-
- data[i] = sin(x) * 180;
+ data[i] = x;
}
else
{
- data[i] = sin(x) * 100;
+ data[i] = x * 100/180.;
}
}
}
diff --git a/tracker-test/test.h b/tracker-test/test.h
index 8338e8f3..01133617 100644
--- a/tracker-test/test.h
+++ b/tracker-test/test.h
@@ -14,9 +14,6 @@ public:
void data(double *data) override;
private:
- static constexpr double r2d = 180 / M_PI;
- static constexpr double d2r = M_PI / 180;
-
static const double incr[6];
double last_x[6];
Timer t;