minkowski() and hull() tests from Len

stl_dim
Marius Kintel 2011-04-28 17:35:28 -04:00
parent eb16c3ea56
commit 9ca6f0dedf
2 changed files with 108 additions and 4 deletions

View File

@ -1,5 +1,43 @@
hull() {
translate([15,10,0])
circle(10);
// Works correctly
module convex2dSimple() {
hull() {
translate([15,10]) circle(10);
circle(10);
}
}
// Works correctly
module convex2dHole() {
hull() {
translate([15,10,0]) circle(10);
difference() {
circle(10);
circle(5);
}
}
}
// 3d not currently implemented
module convex3dSimple() {
hull() {
translate([15,10]) cylinder(r=10);
cylinder(r=10);
}
}
// 3d not currently implemented
module convex3dHole() {
hull() {
translate([15,10,0]) cylinder(10);
difference() {
cylinder(10);
cylinder(5);
}
}
}
convex2dHole();
translate([40,0,0]) convex2dSimple();
translate([0,40,0]) convex3dHole();
translate([40,40,0]) convex3dSimple();

View File

@ -1 +1,67 @@
minkowski();
// Rounded box using 3d minkowski
module roundedBox3dSimple() {
minkowski() {
cube([10,10,5]);
cylinder(r=5, h=5);
}
}
// Currently segfaults
module roundedBox3dCut() {
minkowski() {
difference() {
cube([10,10,5]);
cube([5,5,5]);
}
cylinder(r=5, h=5);
}
}
// Currently segfaults
module roundedBox3dHole() {
minkowski() {
difference() {
cube([10,10,5]);
translate([2,2,-2]) cube([6,6,10]);
}
cylinder(r=2);
}
}
// Works correctly
module roundedBox2dSimple() {
minkowski() {
square([10,10]);
circle(r=5);
}
}
// Works correctly
module roundedBox2dCut() {
minkowski() {
difference() {
square([10,10]);
square([5,5]);
}
circle(r=5);
}
}
// Not quite correct, result does not contain a hole, since the impl currently returns the outer boundary of the polygon_with_holes.
module roundedBox2dHole() {
minkowski() {
difference() {
square([10,10]);
translate([2,2]) square([6,6]);
}
circle(r=2);
}
}
translate([-25,0,0]) roundedBox2dHole();
translate([0,0,0]) roundedBox2dCut();
translate([25,0,0]) roundedBox2dSimple();
translate([-25,25,0]) roundedBox3dHole();
translate([0,25,0]) roundedBox3dCut();
translate([25,25,0]) roundedBox3dSimple();