summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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;