mirror of
https://bjh21.me.uk/bedstead/.git
synced 2026-07-30 15:33:25 -04:00
Extract code to emit a single contour from emit_path().
I want to make emit_path() more complex, so pulling out this obvious unit seems wise.
This commit is contained in:
parent
bfd3fbdbf7
commit
bc10355aa5
26
bedstead.c
26
bedstead.c
@ -1959,6 +1959,22 @@ clean_path()
|
||||
} while (done_anything);
|
||||
}
|
||||
|
||||
static void
|
||||
emit_contour(point *p0)
|
||||
{
|
||||
point *p = p0, *p1;
|
||||
|
||||
do {
|
||||
printf(" %g %g %s 1\n",
|
||||
(double)p->v.x / XSCALE,
|
||||
(double)p->v.y / YSCALE - 3*YPIX,
|
||||
p == p0 && p->next ? "m" : "l");
|
||||
p1 = p->next;
|
||||
p->prev = p->next = NULL;
|
||||
p = p1;
|
||||
} while (p);
|
||||
}
|
||||
|
||||
static void
|
||||
emit_path()
|
||||
{
|
||||
@ -1970,15 +1986,7 @@ emit_path()
|
||||
if (p->next) {
|
||||
if (!started) printf("Fore\nSplineSet\n");
|
||||
started = 1;
|
||||
do {
|
||||
printf(" %g %g %s 1\n",
|
||||
(double)p->v.x / XSCALE,
|
||||
(double)p->v.y / YSCALE - 3*YPIX,
|
||||
p == &points[i] && p->next ? "m" : "l");
|
||||
p1 = p->next;
|
||||
p->prev = p->next = NULL;
|
||||
p = p1;
|
||||
} while (p);
|
||||
emit_contour(p);
|
||||
}
|
||||
}
|
||||
if (started) printf("EndSplineSet\n");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user