First playing with wireframe
Added some smoothing for spheres and cylinders
This commit is contained in:
parent
26307b897d
commit
8335a271af
21
wireframe.c
21
wireframe.c
@ -222,7 +222,6 @@ int main(void)
|
||||
const stl_header_t * const hdr = (const void*) buf;
|
||||
const stl_face_t * const stl_faces = (const void*)(hdr+1);
|
||||
const int num_triangles = hdr->num_triangles;
|
||||
const float thick = 7.8;
|
||||
const int do_square = 1;
|
||||
|
||||
fprintf(stderr, "header: '%s'\n", hdr->header);
|
||||
@ -295,17 +294,21 @@ int main(void)
|
||||
}
|
||||
|
||||
fprintf(stderr, "%d unique vertices\n", num_vertex);
|
||||
printf("thick=%f;\n"
|
||||
printf("thick=1.0;\n"
|
||||
"radius=1.0;\n"
|
||||
"leg_height=1.0;\n"
|
||||
"wall=0.5;\n"
|
||||
"smooth=100;\n"
|
||||
"leglen_percentage=0.48;\n"
|
||||
"module connector(len) {\n"
|
||||
" render() difference() {\n"
|
||||
" cylinder(r=thick/2+2, h=2*thick);\n"
|
||||
" cylinder(r=thick/2+wall, h=leg_height*thick, $fn=smooth);\n"
|
||||
//" translate([0,0,len/2+2]) cube([thick,thick,2*thick]);\n"
|
||||
" translate([0,0,thick/2+2]) cylinder(r=thick/2, h=2*thick);\n"
|
||||
" translate([0,0,thick/2+2]) cylinder(r=thick/2, h=2*thick, $fn=smooth);\n"
|
||||
" }\n"
|
||||
//" %%translate([0,0,len*0.48/2]) cube([thick,thick,len*0.48], center=true);\n"
|
||||
" %%translate([0,0,0]) cylinder(r=thick/2, h=len*0.48);\n"
|
||||
"}\n",
|
||||
thick
|
||||
" %%translate([0,0,0]) cylinder(r=thick/2, h=len*leglen_percentage, $fn=smooth);\n"
|
||||
"}\n"
|
||||
);
|
||||
|
||||
for (int i = 0 ; i < num_vertex ; i++)
|
||||
@ -317,7 +320,7 @@ int main(void)
|
||||
v->p.p[2]
|
||||
);
|
||||
|
||||
printf("sphere(r=%f); // %d %p\n", thick/2+2, i, v);
|
||||
printf("sphere(radius, $fn=smooth); // %d %p\n", i, v);
|
||||
|
||||
for (int j = 0 ; j < v->num_edges ; j++)
|
||||
{
|
||||
@ -333,7 +336,7 @@ int main(void)
|
||||
if (do_square)
|
||||
printf("connector(%f);\n", len);
|
||||
else
|
||||
printf(" cylinder(r=1, h=%f); // %p\n",
|
||||
printf(" cylinder(r=1, h=%f, $fn=smooth); // %p\n",
|
||||
len*.45,
|
||||
v2
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user