1
0
mirror of git://projects.qi-hardware.com/cae-tools.git synced 2024-12-23 09:55:32 +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; int lineno = 0;
char buf[1024]; char buf[1024];
struct path *paths = NULL, **anchor = &paths, *path = NULL; struct path *paths = NULL, **anchor = &paths, *path = NULL;
int start_x = 0, start_y = 0; double start_x = 0, start_y = 0;
int x, y, d; int xi, yi, d;
double x, y;
file = name ? fopen(name, "r") : stdin; file = name ? fopen(name, "r") : stdin;
if (!file) { if (!file) {
@ -64,10 +65,10 @@ struct path *gerber_read(const char *name, double r_tool_default)
} }
continue; 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; continue;
x = KU2MM(x); x = KU2MM(xi);
y = KU2MM(y); y = KU2MM(yi);
switch (d) { switch (d) {
case 1: case 1:
if (!path) { if (!path) {