Revision 1019
Theta changes now.
motion.c | ||
---|---|---|
47 | 47 |
|
48 | 48 |
double newx = radius * sin(t); |
49 | 49 |
double newy = radius - radius * cos(t); |
50 |
|
|
50 |
|
|
51 | 51 |
r->pose.x += newx * cos(theta); |
52 | 52 |
r->pose.y += newx * sin(theta); |
53 | 53 |
|
54 | 54 |
r->pose.x += newy * - sin(theta); |
55 | 55 |
r->pose.y += newy * cos(theta); |
56 |
|
|
57 |
r->pose.theta = fmod((t + theta), (2 * M_PI)); |
|
56 |
|
|
57 |
int divide = (t+r->pose.theta)/(2 * M_PI); |
|
58 |
r->pose.theta = (t+r->pose.theta) - (2 * M_PI * divide); |
|
58 | 59 |
if (r->pose.theta<0) r->pose.theta += 2 * M_PI; |
59 | 60 |
|
60 | 61 |
return 0; |
Also available in: Unified diff