readme, makefile and warning fixes

This commit is contained in:
Trammell Hudson 2014-12-14 17:42:18 -05:00
parent 1ecf472270
commit 5f7c406716
3 changed files with 23 additions and 1 deletions

15
Makefile Normal file
View File

@ -0,0 +1,15 @@
CFLAGS = \
-g \
-O3 \
-W \
-Wall \
LDFLAGS = \
-lm \
all: unfold
unfold: unfold.o
clean:
$(RM) *.o

4
README.md Normal file
View File

@ -0,0 +1,4 @@
Takes a binary STL file as input and generates a SVG that contains the
triangles "folded flat" so that they can be laser cut.
Work in progress -- not yet feature complete.

View File

@ -7,6 +7,7 @@
#include <stdint.h> #include <stdint.h>
#include <unistd.h> #include <unistd.h>
#include <math.h> #include <math.h>
#include <err.h>
#ifndef M_PI #ifndef M_PI
#define M_PI 3.1415926535897932384 #define M_PI 3.1415926535897932384
@ -221,6 +222,8 @@ recurse(
trans_x = 0; trans_x = 0;
trans_y = 0; trans_y = 0;
rotate = atan2(y2, x2) * 180 / M_PI; rotate = atan2(y2, x2) * 180 / M_PI;
} else {
errx(EXIT_FAILURE, "edge %d invalid?\n", edge);
} }
printf("<!-- edge %d --><g transform=\"translate(%f,%f) rotate(%f)\">\n", printf("<!-- edge %d --><g transform=\"translate(%f,%f) rotate(%f)\">\n",
@ -384,7 +387,7 @@ int main(void)
// all three edges should be matched // all three edges should be matched
if (f->next[0] && f->next[1] && f->next[2]) if (f->next[0] && f->next[1] && f->next[2])
continue; continue;
fprintf(stderr, "%d: missing edges?\n", i); errx(EXIT_FAILURE, "%d missing edges?\n", i);
} }
// we now have a graph that shows the connection between // we now have a graph that shows the connection between