diff --git a/cameo/shape.c b/cameo/shape.c index f473f01..f360c1c 100644 --- a/cameo/shape.c +++ b/cameo/shape.c @@ -17,17 +17,14 @@ #include "shape.h" -static struct path *path; - - static double arc2angle(double arc, double r) { return acos(1-arc*arc/(r*r)/2); } -static void half_circle(double cx, double cy, double rx, double ry, double z, - double s) +static void half_circle(struct path *path, + double cx, double cy, double rx, double ry, double z, double s) { double m[4]; double x = rx, y = ry, tmp; @@ -51,6 +48,7 @@ static void half_circle(double cx, double cy, double rx, double ry, double z, struct path *slot(double xa, double ya, double xb, double yb, double z, double sr, double tr, double step, const char *id) { + struct path *path; double dx = xb-xa; double dy = yb-ya; double s = arc2angle(step, sr); @@ -66,8 +64,8 @@ struct path *slot(double xa, double ya, double xb, double yb, double z, nx = -dy*f; ny = dx*f; - half_circle(xa, ya, nx, ny, z, s); - half_circle(xb, yb, -nx, -ny, z, s); + half_circle(path, xa, ya, nx, ny, z, s); + half_circle(path, xb, yb, -nx, -ny, z, s); path_add(path, xa+nx, ya+ny, z); } return path; @@ -77,6 +75,7 @@ struct path *slot(double xa, double ya, double xb, double yb, double z, struct path *circle(double cx, double cy, double cz, double cr, double tr, double step, const char *id) { + struct path *path; double s = arc2angle(step, cr); double a;