summaryrefslogtreecommitdiff
path: root/testdata/scad/features/intersection-tests.scad
blob: d4e32dbddd4d32fd00b39e9bc9272cfe199d15b5 (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
// Empty
intersection();

// No children
intersection() { }

intersection() {
  sphere(r=5);
  translate([0,0,3]) cube([4,4,6], center=true);
}

translate([0,12,0]) intersection() {
  cube([10,10,10], center=true);
  cylinder(r=4, h=12, center=true);
}

translate([12,0,0]) intersection() {
  cube([10,10,10], center=true);
  cylinder(r=4, h=12, center=true);
  rotate([0,90,0]) cylinder(r=4, h=12, center=true);
}

translate([12,12,0]) intersection() {
  cube([10,10,10], center=true);
  translate([0,0,7.01]) cylinder(r=4, h=4, center=true);
}

translate([24,0,0]) intersection() {
  cube([10,10,10], center=true);
  translate([0,0,6.99]) cylinder(r=4, h=4, center=true);
}

translate([-12,0,0]) intersection() {
  cube([10,10,10], center=true);
  translate([0,-10,-10]) cube([10,10,10], center=true);
}

translate([-12,12,0]) intersection() {
  cube([10,10,10], center=true);
  translate([0,-9.99,-9.99]) cube([10,10,10], center=true);
}

// Intersecting something with nothing
translate([0,-12,0]) intersection() {
  cylinder(r=4, h=5, center=true);
  cube(0);
}

// Intersecting 2D with 3D
translate([12,-12,0]) intersection() {
  cube([5,5,5], center=true);
  circle(r=2);
}

// Non-geometry (echo) statement as first child should be ignored
translate([24,-12,0]) intersection() {
  echo("difference-tests");
  cube([5,5,5], center=true);
  cylinder(r=2, h=20, center=true);
}
contact: Jan Huwald // Impressum