summaryrefslogtreecommitdiff
path: root/ambiguous-cylinders.scad
diff options
context:
space:
mode:
Diffstat (limited to 'ambiguous-cylinders.scad')
-rw-r--r--ambiguous-cylinders.scad73
1 files changed, 73 insertions, 0 deletions
diff --git a/ambiguous-cylinders.scad b/ambiguous-cylinders.scad
new file mode 100644
index 0000000..9a59522
--- /dev/null
+++ b/ambiguous-cylinders.scad
@@ -0,0 +1,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([ [-5, 0], [-4.5, 1], [ 2, 1], [ 2.5, 3], [ 5, 0],
+ [ 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);
+}