Mark Harrison
2018-08-04 06:39:49 UTC
Here's something I'm having trouble understanding, if someone can help
me understand I'd be very appreciative.
Here's a nifty way of drawing a cube with cut off corners.
But, it fails on the mirror of the corner at [1,1,1].
module corner(wid) {
corner_points = [[0,0,0],[1,0,0],[0,1,0],[0,0,1]];
corner_faces = [[0,3,1],[0,2,3],[0,1,2],[1,3,2]];
polyhedron(wid*corner_points, corner_faces);
}
module cornercube(wid, cornerwid) {
cube_vertices = [[0,0,0],[0,0,1],[0,1,0],[0,1,1],
[1,0,0],[1,0,1],[1,1,0],[1,1,1]];
difference() {
cube(wid);
for (v = cube_vertices) {
#translate(wid*v) mirror(v) corner(cornerwid);
}
}
}
cornercube(20,5);
This code fixes things by handling that corner as a special case.
Can someone explain to me what's different about the one corner?
And is there some transformation that will work on all eight corners?
module cornercube2(wid,cornerwid) {
cube_vertices7 = [[0,0,0],[0,0,1],[0,1,0],[0,1,1],
[1,0,0],[1,0,1],[1,1,0]];
cube_vertices1 = [[1,1,1]];
difference() {
cube(wid);
for (v = cube_vertices7) {
translate(wid*v) mirror(v) corner(cornerwid);
}
for (v = cube_vertices1) {
#translate(wid*v) rotate([180,90,0]) corner(cornerwid);
}
}
}
cornercube2(20,5);
me understand I'd be very appreciative.
Here's a nifty way of drawing a cube with cut off corners.
But, it fails on the mirror of the corner at [1,1,1].
module corner(wid) {
corner_points = [[0,0,0],[1,0,0],[0,1,0],[0,0,1]];
corner_faces = [[0,3,1],[0,2,3],[0,1,2],[1,3,2]];
polyhedron(wid*corner_points, corner_faces);
}
module cornercube(wid, cornerwid) {
cube_vertices = [[0,0,0],[0,0,1],[0,1,0],[0,1,1],
[1,0,0],[1,0,1],[1,1,0],[1,1,1]];
difference() {
cube(wid);
for (v = cube_vertices) {
#translate(wid*v) mirror(v) corner(cornerwid);
}
}
}
cornercube(20,5);
This code fixes things by handling that corner as a special case.
Can someone explain to me what's different about the one corner?
And is there some transformation that will work on all eight corners?
module cornercube2(wid,cornerwid) {
cube_vertices7 = [[0,0,0],[0,0,1],[0,1,0],[0,1,1],
[1,0,0],[1,0,1],[1,1,0]];
cube_vertices1 = [[1,1,1]];
difference() {
cube(wid);
for (v = cube_vertices7) {
translate(wid*v) mirror(v) corner(cornerwid);
}
for (v = cube_vertices1) {
#translate(wid*v) rotate([180,90,0]) corner(cornerwid);
}
}
}
cornercube2(20,5);