remove pegs, shift to origin

This commit is contained in:
Trammell Hudson 2015-03-07 13:20:12 -05:00
parent 95574e3530
commit 976248e5f6

View File

@ -158,12 +158,12 @@ main(void)
const stl_vertex_t * const v = &stl->vertex[i]; const stl_vertex_t * const v = &stl->vertex[i];
const v3_t origin = v->p; const v3_t origin = v->p;
printf("// vertex %d\n" printf("//translate([%f,%f,%f])\n"
"//translate([%f,%f,%f])\n" "module vertex_%d() {\n"
"{\n"
"render() difference()\n" "render() difference()\n"
"{\n", "{\n",
i, origin.p[0], origin.p[1], origin.p[2]); origin.p[0], origin.p[1], origin.p[2], i);
avg_x.p[0] = avg_x.p[1] = avg_x.p[2] = 0; avg_x.p[0] = avg_x.p[1] = avg_x.p[2] = 0;
avg_y.p[0] = avg_y.p[1] = avg_y.p[2] = 0; avg_y.p[0] = avg_y.p[1] = avg_y.p[2] = 0;
avg_z.p[0] = avg_z.p[1] = avg_z.p[2] = 0; avg_z.p[0] = avg_z.p[1] = avg_z.p[2] = 0;
@ -185,18 +185,24 @@ main(void)
printf("} // difference\n"); printf("} // difference\n");
// add back in the mounting pegs // add back in the mounting pegs
make_faces(stl, v, 0, 0, 0, hole_dist, hole_rad, thickness); //make_faces(stl, v, 0, 0, 0, hole_dist, hole_rad, thickness);
printf("} // union\n"); printf("}\n");
refframe_t avg;
refframe_init(&avg, avg_x, avg_y, avg_z);
printf("translate([0,0,15]) render() intersection() {\n");
printf("rotate([0,-90,0])");
print_multmatrix(&avg, 1);
printf("vertex_%d();\n", i);
printf("cube([100,100,30], center=true);\n");
printf("}\n");
break; break;
//if (i == 0) break; // only do one right now //if (i == 0) break; // only do one right now
} }
refframe_t avg;
refframe_init(&avg, avg_x, avg_y, avg_z);
printf("%%");
print_multmatrix(&avg, 1);
//printf("translate([0,0,20]) sphere(r=2);\n"); //printf("translate([0,0,20]) sphere(r=2);\n");
printf("cube([50,50,50], center=true);\n");
return 0; return 0;
} }