1
0
mirror of git://projects.qi-hardware.com/cae-tools.git synced 2025-04-21 12:27:27 +03:00

cameo/: added option "any" to "mill", to accept paths irrespective of tool size

This commit is contained in:
Werner Almesberger
2011-08-31 21:17:29 -03:00
parent 54101eaaf4
commit 75c3a7d1d2
5 changed files with 47 additions and 22 deletions

View File

@@ -1,8 +1,8 @@
/*
* shape.c - Toolpaths for basic shapes
*
* Written 2010 by Werner Almesberger
* Copyright 2010 Werner Almesberger
* Written 2010-2011 by Werner Almesberger
* Copyright 2010-2011 Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -57,14 +57,19 @@ struct path *slot(double xa, double ya, double xb, double yb, double z,
double nx, ny;
double f;
f = (sr-tr)/hypot(dx, dy);
nx = -dy*f;
ny = dx*f;
path = path_new(tr);
half_circle(xa, ya, nx, ny, z, s);
half_circle(xb, yb, -nx, -ny, z, s);
path_add(path, xa+nx, ya+ny, z);
if (sr <= tr) {
path_add(path, xa, ya, z);
path_add(path, xb, yb, z);
} else {
f = (sr-tr)/hypot(dx, dy);
nx = -dy*f;
ny = dx*f;
half_circle(xa, ya, nx, ny, z, s);
half_circle(xb, yb, -nx, -ny, z, s);
path_add(path, xa+nx, ya+ny, z);
}
return path;
}
@@ -76,8 +81,13 @@ struct path *circle(double cx, double cy, double cz, double cr, double tr,
double a;
path = path_new(tr);
for (a = 0; a < 2*M_PI; a += s)
path_add(path, cx+(cr-tr)*cos(a), cy+(cr-tr)*sin(a), cz);
path_add(path, cx+(cr-tr), cy, cz);
if (cr <= tr) {
path_add(path, cx, cy, cz);
} else {
for (a = 0; a < 2*M_PI; a += s)
path_add(path,
cx+(cr-tr)*cos(a), cy+(cr-tr)*sin(a), cz);
path_add(path, cx+(cr-tr), cy, cz);
}
return path;
}