1
0
mirror of git://projects.qi-hardware.com/cae-tools.git synced 2024-12-23 16:19:54 +02:00
cae-tools/cameo/cameo.c

64 lines
1.2 KiB
C
Raw Normal View History

/*
* cameo.c - Toolpath adaptation and machine control
*
* Written 2010 by Werner Almesberger
* Copyright 2010 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include "path.h"
#include "gnuplot.h"
static void usage(const char *name)
{
fprintf(stderr, "usage: %s r_mm [in.gnuplot [out.gnuplot]]\n",
name);
exit(1);
}
int main(int argc, char **argv)
{
char *in = NULL, *out = NULL;
double r;
struct path *paths;
switch (argc) {
case 4:
out = argv[3];
/* fall through */
case 3:
in = argv[2];
/* fall through */
case 2:
r = atof(argv[1]);
break;
default:
usage(*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);
gnuplot_write(out, paths);
return 0;
}