From 99592248d9a286c50adc76bcb49347b51ba0785c Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Wed, 15 Dec 2010 12:26:44 -0300 Subject: [PATCH] cameo/gerber.c (gerber_read): store coordinates as floats after conversion They all were truncated. --- cameo/gerber.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cameo/gerber.c b/cameo/gerber.c index 9aca5f5..5d26a5b 100644 --- a/cameo/gerber.c +++ b/cameo/gerber.c @@ -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) {