summaryrefslogtreecommitdiff
path: root/ambiguous-cylinders.scad
blob: 9a595225844acd4d604ddd3d1ad14a3de9f24426 (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
68
69
70
71
72
73
module view_cylinder(shift=100/3,height=200,thin=0.1) {
     translate([0,0,-shift]) {
          difference() {
               linear_extrude(height=height,center=false) {
                    offset(r=thin/2) children(0);
               }
               linear_extrude(height=height,center=false) {
                    offset(r=-thin/2) children(0);
               }
          }
     }
}
 
module intersect_view_cylinders(angle=45,size=100,thin=0.1) {
     shift=size/3;
     height=size*2;
 
     intersection() {
          rotate([0,angle,0]) view_cylinder(shift,height,thin) children(0);
          rotate([0,-angle,0]) view_cylinder(shift,height,thin) children(1);
     }
};
 
module clip_intersect_view(angle=45,size=100,thin=0.1) {
     bound=size*2;
     skip=0;
 
     intersection() {
          intersect_view_cylinders(angle,size,thin) {
               children(0);
               children(1);
          }
          translate([0,-size/2,0]) rotate([0,-90-angle,0]) cube([size,size,size]);
     }
     intersection() {
          intersect_view_cylinders(angle,size,thin) {
               children(0);
               children(1);
          }
          translate([0,-size/2,0]) rotate([0,90-angle,0]) cube([size,size,size]);
     }
};
 
module ambiguous_cylinder(angle=45,size=100,thin=0.1,thick=1,height=10) {
     minkowski() {
          clip_intersect_view(angle,size,thin) {
               children(0);
               children(1);
          }
          cylinder(r=thick,h=height*2,center=true);
     }
}
 
/* Arrow that always points right
  */
module arrow(length=10) {
     scale([length/10,length/10,length/10])
          polygon([ [-50][-4.51][ 21][ 2.53][ 50],
                    [ 2.5,-3][ 2,-1][-4.5,-1] ]);
}
 
ambiguous_cylinder() {
     rotate([0,0,90]) arrow(30);
     rotate([0,0,-90]) arrow(30);
}
 
/* circle / diamond
 */
 
translate([0,50,0]) ambiguous_cylinder() {
     circle(d=14);
     rotate([0,0,45]) square(size=10,center=true);
}