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

cameo: detect and adjust handedness

- cameo/path.h, cameo/path.c (offset_point, path_offset): added "left"
  argument to indicate the handedness
- cameo/path.h, cameo/path.c (path_tool_is_left): new function to determine
  which way the path turns
- cameo/cameo.c: auto-detect handedness and instruct path_offset accordingly
This commit is contained in:
Werner Almesberger
2010-11-01 15:43:37 -03:00
parent 0bc780611d
commit 54d8549fa2
3 changed files with 65 additions and 11 deletions

View File

@@ -32,6 +32,7 @@ int main(int argc, char **argv)
char *in = NULL, *out = NULL;
double r;
struct path *paths;
int left;
switch (argc) {
case 4:
@@ -50,14 +51,13 @@ int main(int argc, char **argv)
/*
* To do:
* - auto-detect orientation
* - handle multiple paths
* - instead of reversing the path, reverse the handedness
*/
paths = gnuplot_read(in, r);
assert(!paths->next); /* we don't handle this yet */
paths = path_reverse(paths);
paths = path_offset(paths, 1);
// paths = path_reverse(paths);
left = path_tool_is_left(paths);
paths = path_offset(paths, left, 1);
gnuplot_write(out, paths);
return 0;
}