add corrections to coordinates in alryslib.c

This commit is contained in:
Pavel 2021-10-16 12:04:28 +02:00
parent 6ba7093885
commit 377914bafb
2 changed files with 7 additions and 3 deletions

View File

@ -176,7 +176,7 @@ void right(struct STATE *state, double a)
double score(double *steps, int size)
{
int i;
double a, x, y, l;
double a, b, x, y, l;
double position[] = {47.5, 43.5, 0.0};
struct STATE state;
@ -194,8 +194,12 @@ double score(double *steps, int size)
for(i = 0; i < size; ++i)
{
x = steps[0 + i * 2];
y = steps[1 + i * 2];
x = steps[0 + i * 4];
a = steps[1 + i * 4];
y = steps[2 + i * 4];
b = steps[3 + i * 4];
x += a * 1e-14;
y += b * 1e-14;
a = atan2(y - position[1], x - position[0]) * 180.0 / M_PI - position[2];
l = hypot(x - position[0], y - position[1]);
right(&state, a);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 896 KiB

After

Width:  |  Height:  |  Size: 896 KiB