mirror of
git://projects.qi-hardware.com/cae-tools.git
synced 2024-12-22 18:21:08 +02:00
cameo/shape.c: removed global "path" variable (where did that madness come from ?)
This commit is contained in:
parent
a42a18fef3
commit
a67d0b447e
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user