summaryrefslogtreecommitdiff
path: root/testdata/scad/minkowski.scad
blob: 6d0dade9cfdd818aa1da815ec11b9b5e3f7d567a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

// 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();
contact: Jan Huwald // Impressum