summaryrefslogtreecommitdiff
path: root/meme/meme.c
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2015-03-15 21:51:46 (GMT)
committerWerner Almesberger <werner@almesberger.net>2015-03-15 21:51:46 (GMT)
commit1f33a9716932836c257295dd02f1f24abcb0eb4f (patch)
treeb1f52c8005ec5b73c36c72678be580511fe2bd1f /meme/meme.c
parent57ff0b618c936a0f48d445f78beaeb6b7b000f59 (diff)
downloadmisc-1f33a9716932836c257295dd02f1f24abcb0eb4f.zip
misc-1f33a9716932836c257295dd02f1f24abcb0eb4f.tar.gz
misc-1f33a9716932836c257295dd02f1f24abcb0eb4f.tar.bz2
meme/: generalize overlay handling (let caller provide coordinate transform)
This will let us share the code with vispcb.
Diffstat (limited to 'meme/meme.c')
-rw-r--r--meme/meme.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/meme/meme.c b/meme/meme.c
index 4480f3f..2a8d11b 100644
--- a/meme/meme.c
+++ b/meme/meme.c
@@ -15,6 +15,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
+#include <math.h>
#include "time.h"
#include "mesh.h"
@@ -52,6 +53,13 @@ static void slice_out(double x, double y, double z, bool last)
}
+static void overlay_xform(float x, float y, float *res_x, float *res_y)
+{
+ *res_x = round(x * 1000);
+ *res_y = round(y * 1000);
+}
+
+
static void usage(const char *name)
{
fprintf(stderr,
@@ -85,7 +93,8 @@ int main(int argc, char **argv)
fprintf(stderr, "too many overlays\n");
exit(1);
}
- overlays[n_overlays] = overlay_load(optarg);
+ overlays[n_overlays] = overlay_load(optarg,
+ overlay_xform);
n_overlays++;
break;
case 's':