summaryrefslogtreecommitdiff
path: root/meme/meme.c
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2015-03-14 11:10:08 (GMT)
committerWerner Almesberger <werner@almesberger.net>2015-03-14 11:10:08 (GMT)
commit5063fcc259c3f5c485ade53ea2a1b1882bec2d30 (patch)
tree579fa96ebac862b54651c8f0aad219c43ae0a4c4 /meme/meme.c
parent7d70682e30d87204e1e441c7f6c7ecbd68fe1a07 (diff)
downloadmisc-5063fcc259c3f5c485ade53ea2a1b1882bec2d30.zip
misc-5063fcc259c3f5c485ade53ea2a1b1882bec2d30.tar.gz
misc-5063fcc259c3f5c485ade53ea2a1b1882bec2d30.tar.bz2
meme/: new option -s slice.gp for intersect the mesh with a plane (WIP)
Diffstat (limited to 'meme/meme.c')
-rw-r--r--meme/meme.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/meme/meme.c b/meme/meme.c
index 411b7ca..0b1049d 100644
--- a/meme/meme.c
+++ b/meme/meme.c
@@ -19,6 +19,7 @@
#include "mesh.h"
#include "stl.h"
#include "overlay.h"
+#include "slice.h"
extern void gui(const char *logfile);
@@ -43,10 +44,18 @@ static unsigned count_edges(void)
}
+static void slice_out(double x, double y, double z, bool last)
+{
+ printf("%f %f %f\n%s", x, y, z, last ? "\n" : "");
+}
+
+
static void usage(const char *name)
{
- fprintf(stderr, "usage: %s [-l logfile] [-o overlap.gp] [file.stl]\n",
- name);
+ fprintf(stderr,
+"usage: %s [-l logfile] [-o overlap.gp] [file.stl]\n"
+" %s -s plane.gp [file.stl]\n",
+ name, name);
exit(1);
}
@@ -56,9 +65,10 @@ int main(int argc, char **argv)
int c;
const char *logfile = NULL;
const char *overlay = NULL;
+ const char *slice = NULL;
struct time t_load;
- while ((c = getopt(argc, argv, "l:o:")) != EOF)
+ while ((c = getopt(argc, argv, "l:o:s:")) != EOF)
switch (c) {
case 'l':
logfile = optarg;
@@ -66,6 +76,9 @@ int main(int argc, char **argv)
case 'o':
overlay = optarg;
break;
+ case 's':
+ slice = optarg;
+ break;
default:
usage(*argv);
}
@@ -88,6 +101,12 @@ int main(int argc, char **argv)
fprintf(stderr, "STL loaded in %.3f s\n", time_ms(&t_load)/1000.0);
fprintf(stderr, "%u edges\n", count_edges());
+ if (slice) {
+ slice_load(slice);
+ slice_run(slice_out, 0);
+ exit(1);
+ }
+
if (overlay)
overlay_load(overlay);