From 6d70656ab2b280c9b77676a0d2f72928bdee88b8 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Wed, 21 Mar 2012 01:00:12 -0300 Subject: [PATCH] cameo/path.c (path_offset): handle also degenerate polygons of only one point To do: use a square, not a circle. Also, extend this to degenerate polygons consisting of two points. --- cameo/path.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cameo/path.c b/cameo/path.c index 2abd18d..dfdb92f 100644 --- a/cameo/path.c +++ b/cameo/path.c @@ -1,8 +1,8 @@ /* * path.c - Toolpath operations * - * Written 2010-2011 by Werner Almesberger - * Copyright 2010-2011 Werner Almesberger + * Written 2010-2012 by Werner Almesberger + * Copyright 2010-2012 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 @@ -17,6 +17,7 @@ #include #include "util.h" +#include "shape.h" #include "path.h" @@ -316,6 +317,9 @@ struct path *path_offset(const struct path *path, int left, int notch) int dog; 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); new = path_from(path); prev = path->first; for (p = path->first->next; p; p = p->next) {