mirror of
git://projects.qi-hardware.com/cae-tools.git
synced 2024-12-23 00:16:27 +02:00
cameo/lang.y (align): completed alignment function
This commit is contained in:
parent
1f63ef6391
commit
c8b62c2864
27
cameo/lang.y
27
cameo/lang.y
@ -74,7 +74,32 @@ static void ref_pick_xy(int ref, double xa, double ya, double xb, double yb,
|
||||
|
||||
static void align(int ref, double x, double y)
|
||||
{
|
||||
/* @@@ */
|
||||
const struct path *path;
|
||||
const struct point *p;
|
||||
double xa = 0, ya = 0, xb = 0, yb = 0;
|
||||
double xr, yr, xd, yd;
|
||||
int first = 1;
|
||||
|
||||
for (path = paths; path; path = path->next)
|
||||
for (p = path->first; p; p = p->next) {
|
||||
if (first || p->x < xa)
|
||||
xa = p->x;
|
||||
if (first || p->x > xb)
|
||||
xb = p->x;
|
||||
if (first || p->y < ya)
|
||||
ya = p->y;
|
||||
if (first || p->y > yb)
|
||||
yb = p->y;
|
||||
first = 0;
|
||||
}
|
||||
|
||||
ref_pick_xy(ref, xa, ya, xb, yb, &xr, &yr);
|
||||
xd = x-xr;
|
||||
yd = y-yr;
|
||||
|
||||
translate(xd, yd, 0);
|
||||
xo += xd;
|
||||
yo += yd;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user