diff --git a/cameo/path.c b/cameo/path.c index c2a4707..f8a8515 100644 --- a/cameo/path.c +++ b/cameo/path.c @@ -106,6 +106,17 @@ static int path_is_closed(const struct path *path) } +static void assert_path_is_closed(const struct path *path) +{ + if (path_is_closed(path)) + return; + fprintf(stderr, "path from (%g, %g, %g) to (%g, %g, %g) is open\n", + path->first->x, path->first->y, path->first->z, + path->last->x, path->last->y, path->last->z); + abort(); +} + + static void path_add_point(struct path *path, struct point *p) { if (path->last && @@ -284,7 +295,8 @@ int path_tool_is_left(const struct path *path) const struct point *prev, *p, *next; double a = 0; - assert(path_is_closed(path)); + + assert_path_is_closed(path); prev = path->first; for (p = path->first->next; p; p = p->next) { next = p->next ? p->next : path->first->next; @@ -335,7 +347,7 @@ struct path *path_offset(const struct path *path, int left, int notch) struct point *n, *n2; int dog; - assert(path_is_closed(path)); + assert_path_is_closed(path); if (path->first == path->last) return circle(path->first->x, path->first->y, path->first->z, path->r_tool, path->r_tool, 0.1, path->id);