Skip to content

Commit

Permalink
change output file name, recommend wood size
Browse files Browse the repository at this point in the history
  • Loading branch information
fenrus75 committed Nov 23, 2019
1 parent c00d911 commit 4eb9344
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ WOBJS := stl.wo main.wo triangle.wo image.wo
@gcc $(CFLAGS) -Wno-address-of-packed-member -flto -ffunction-sections -Wall -W -O3 -g -c $< -o $@

%.wo : %.c fenrus.h Makefile
x86_64-w64-mingw32-gcc -Wno-address-of-packed-member -Wall -W -O3 -g -c $< -o $@
@x86_64-w64-mingw32-gcc -Wno-address-of-packed-member -Wall -W -O3 -g -c $< -o $@


stl2png: Makefile fenrus.h $(OBJS)
Expand Down
13 changes: 12 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>

#include "fenrus.h"



int main(int argc, char **argv)
{
char *output, *stl;
if (argc <= 1) {
printf("Usage:\n\tstl2c2d <file.stl>\n");
return EXIT_SUCCESS;
Expand All @@ -26,7 +28,16 @@ int main(int argc, char **argv)
scale_design(512);
print_triangle_stats();

create_image("/var/www/html/stl/output.png");
output = strdup(argv[1]);
stl = strstr(output, ".stl");
if (stl)
strcpy(stl, ".png");
else
output = strdup("output.png");


create_image(output);
printf("Wrote %s\n", output);
return EXIT_SUCCESS;

}
8 changes: 6 additions & 2 deletions triangle.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,15 @@ double scale_Z(void)
}
void print_triangle_stats(void)
{
printf("Space allocated for triangles : %i\n", maxtriangle);
printf("Actual number of triangles : %i\n", current);
double scale;
printf("Number of triangles in file : %i\n", current);
printf("Span of the design : (%5.1f, %5.1f, %5.1f) - (%5.1f, %5.1f, %5.1f) \n",
minX, minY, minZ, maxX, maxY, maxZ);
printf("Image size : %i x %i \n", image_X(), image_Y());

scale = 0.75 / maxZ;
printf("Recommended wood size : %5.2f\"x %5.2f\" x %5.2f\" \n",
scale * maxX, scale * maxY, scale * maxZ);
}

static double point_to_the_left(double X, double Y, double AX, double AY, double BX, double BY)
Expand Down

0 comments on commit 4eb9344

Please sign in to comment.