1
0
mirror of git://projects.qi-hardware.com/cae-tools.git synced 2025-04-21 12:27:27 +03:00

cameo/: make tool_comp_paths output paths in the order processed

This commit is contained in:
Werner Almesberger
2011-09-05 07:54:29 -03:00
parent 828763b747
commit 639b0fa2d6
6 changed files with 31 additions and 33 deletions

View File

@@ -19,23 +19,24 @@
#include "ops.h"
static void tool_comp_1(struct path *path, int inside, int dog_bone)
static struct path *tool_comp_1(const struct path *path, int inside,
int dog_bone)
{
int left;
struct path *new;
left = path_tool_is_left(path);
if (inside)
new = path_offset(path, !left, path->notch);
return path_offset(path, !left, path->notch);
else
new = path_offset(path, left, path->notch || dog_bone);
path_replace(path, new);
return path_offset(path, left, path->notch || dog_bone);
}
void tool_comp_paths(struct path *paths, int dog_bone, int all_inside)
struct path *tool_comp_paths(const struct path *paths, int dog_bone,
int all_inside)
{
struct path *leftmost, *path;
const struct path *leftmost, *path;
struct path *new = NULL, **anchor = &new;
/*
* We don't have an algorithm (yet) that can detect which paths are
@@ -50,13 +51,18 @@ void tool_comp_paths(struct path *paths, int dog_bone, int all_inside)
leftmost = path_find_leftmost(paths);
for (path = paths; path; path = path->next)
if (path != leftmost && (all_inside || !path->outside))
tool_comp_1(path, 1, dog_bone);
if (path != leftmost && (all_inside || !path->outside)) {
*anchor = tool_comp_1(path, 1, dog_bone);
anchor = &(*anchor)->next;
}
if (!all_inside)
for (path = paths; path; path = path->next)
if (path != leftmost && path->outside)
tool_comp_1(path, 0, dog_bone);
tool_comp_1(leftmost, all_inside, dog_bone);
if (path != leftmost && path->outside) {
*anchor = tool_comp_1(path, 0, dog_bone);
anchor = &(*anchor)->next;
}
*anchor = tool_comp_1(leftmost, all_inside, dog_bone);
return new;
}