1
0
mirror of git://projects.qi-hardware.com/cae-tools.git synced 2024-12-22 23:26:27 +02:00

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.
This commit is contained in:
Werner Almesberger 2012-03-21 01:00:12 -03:00
parent 079608ba6c
commit 6d70656ab2

View File

@ -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 <assert.h>
#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) {