mirror of
git://projects.qi-hardware.com/cae-tools.git
synced 2024-12-23 09:17:42 +02:00
cameo/area.c: removed debugging and obsolete code
This commit is contained in:
parent
6fbdfd7120
commit
6811df57b6
23
cameo/area.c
23
cameo/area.c
@ -125,10 +125,9 @@ static int touch(double ax, double ay, double bx, double by,
|
|||||||
{
|
{
|
||||||
double dx = cx-ax;
|
double dx = cx-ax;
|
||||||
double dy = cy-ay;
|
double dy = cy-ay;
|
||||||
double a = bx*bx+by*by;
|
double a = bx*bx+by*by; /* always positive */
|
||||||
double b = -2*bx*dx-2*by*dy;
|
double b = -2*bx*dx-2*by*dy;
|
||||||
double c = dx*dx+dy*dy-r*r;
|
double c = dx*dx+dy*dy-r*r;
|
||||||
// double d, n0, n1;
|
|
||||||
double d, tmp;
|
double d, tmp;
|
||||||
|
|
||||||
d = b*b-4*a*c;
|
d = b*b-4*a*c;
|
||||||
@ -140,20 +139,6 @@ static int touch(double ax, double ay, double bx, double by,
|
|||||||
return 0;
|
return 0;
|
||||||
*n = tmp;
|
*n = tmp;
|
||||||
return 1;
|
return 1;
|
||||||
#if 0
|
|
||||||
n0 = (-b-d)/2/a;
|
|
||||||
n1 = (-b+d)/2/a;
|
|
||||||
|
|
||||||
if (n0 > 0) {
|
|
||||||
*n = n0;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (n1 > 0) {
|
|
||||||
*n = n1;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -165,8 +150,6 @@ static int hit_segment(double fx, double fy, double tx, double ty,
|
|||||||
double px, py;
|
double px, py;
|
||||||
double na, nb;
|
double na, nb;
|
||||||
|
|
||||||
printf(" seg (%g,%g)+(%g,%g) -> (%g,%g)-(%g,%g)\n",
|
|
||||||
fx, fy, tx, ty, a->x, a->y, b->x, b->y);
|
|
||||||
tx -= fx;
|
tx -= fx;
|
||||||
ty -= fy;
|
ty -= fy;
|
||||||
|
|
||||||
@ -185,7 +168,6 @@ printf(" seg (%g,%g)+(%g,%g) -> (%g,%g)-(%g,%g)\n",
|
|||||||
|
|
||||||
if (!intersect(fx, fy, tx, ty, px, py, dx, dy, &na, &nb))
|
if (!intersect(fx, fy, tx, ty, px, py, dx, dy, &na, &nb))
|
||||||
return 0;
|
return 0;
|
||||||
printf("\tna %g (%g) nb %g (%g)\n", na, fx+tx*na, nb, fx+tx*nb);
|
|
||||||
if (nb <= 0) {
|
if (nb <= 0) {
|
||||||
if (!touch(fx, fy, tx, ty, a->x, a->y, r, enter, &na))
|
if (!touch(fx, fy, tx, ty, a->x, a->y, r, enter, &na))
|
||||||
return 0;
|
return 0;
|
||||||
@ -262,11 +244,9 @@ static void do_line(const struct path *path, const struct path **sub,
|
|||||||
struct path *new;
|
struct path *new;
|
||||||
double x, next;
|
double x, next;
|
||||||
|
|
||||||
printf(" y=%g\n", y);
|
|
||||||
if (!hit_path(xa-3*r_tool, y, xb, y, last, 1, 0, r_tool, &x))
|
if (!hit_path(xa-3*r_tool, y, xb, y, last, 1, 0, r_tool, &x))
|
||||||
return;
|
return;
|
||||||
while (1) {
|
while (1) {
|
||||||
printf(" x=%g\n", x);
|
|
||||||
next = xb;
|
next = xb;
|
||||||
last = NULL;
|
last = NULL;
|
||||||
if (hit_path(x, y, xb, y, path, 1, 1, r_tool, &next))
|
if (hit_path(x, y, xb, y, path, 1, 1, r_tool, &next))
|
||||||
@ -318,7 +298,6 @@ static void fill_path(const struct path *paths, const struct path *path,
|
|||||||
xb -= r_tool;
|
xb -= r_tool;
|
||||||
yb -= 3*r_tool-overlap;
|
yb -= 3*r_tool-overlap;
|
||||||
n = ceil((yb-ya)/(2*r_tool-overlap));
|
n = ceil((yb-ya)/(2*r_tool-overlap));
|
||||||
printf("x[%g:%g] y[%g:%g] n=%d\n", xa, xb, ya, yb, n);
|
|
||||||
for (i = 0; i <= n; i++)
|
for (i = 0; i <= n; i++)
|
||||||
do_line(path, sub, xa, xb, ya+(yb-ya)*((double) i/n),
|
do_line(path, sub, xa, xb, ya+(yb-ya)*((double) i/n),
|
||||||
r_tool, overlap, res);
|
r_tool, overlap, res);
|
||||||
|
Loading…
Reference in New Issue
Block a user