1
0
mirror of git://projects.qi-hardware.com/cae-tools.git synced 2024-12-22 23:26:27 +02:00

cameo/gerber.c (gerber_read): store coordinates as floats after conversion

They all were truncated.
This commit is contained in:
Werner Almesberger 2010-12-15 12:26:44 -03:00
parent 7cb25c5a3f
commit 99592248d9

View File

@ -37,8 +37,9 @@ struct path *gerber_read(const char *name, double r_tool_default)
int lineno = 0;
char buf[1024];
struct path *paths = NULL, **anchor = &paths, *path = NULL;
int start_x = 0, start_y = 0;
int x, y, d;
double start_x = 0, start_y = 0;
int xi, yi, d;
double x, y;
file = name ? fopen(name, "r") : stdin;
if (!file) {
@ -64,10 +65,10 @@ struct path *gerber_read(const char *name, double r_tool_default)
}
continue;
}
if (sscanf(buf, "X%dY%dD%d*\n", &x, &y, &d) != 3)
if (sscanf(buf, "X%dY%dD%d*\n", &xi, &yi, &d) != 3)
continue;
x = KU2MM(x);
y = KU2MM(y);
x = KU2MM(xi);
y = KU2MM(yi);
switch (d) {
case 1:
if (!path) {