readme, makefile and warning fixes
This commit is contained in:
parent
1ecf472270
commit
5f7c406716
15
Makefile
Normal file
15
Makefile
Normal 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
4
README.md
Normal 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.
|
5
unfold.c
5
unfold.c
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user