chiark / gitweb /
sewing-table: wip change to edge referent (holes =>: corners (nfc)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 1 Jan 2017 22:01:50 +0000 (22:01 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 1 Jan 2017 22:01:50 +0000 (22:01 +0000)
Introduce corners in TestPiece*
Introduce TestPiece_holes2corners
Change TileBase argument

sewing-table.scad.m4

index 64867309c303d99de8260fa680cf5c390995ca78..fe32ca5c4f193d6c8c3ed8ffca85abebdcdc4895 100644 (file)
@@ -36,6 +36,10 @@ echo(str("HOLES IN PLY ctr dist from TILE ROUND edge = ",
         tile_hard_edge_hole_dist + round_edge_rad));
 
 thehd = [ tile_hard_edge_hole_dist, tile_hard_edge_hole_dist ];
+thehd_tr = thehd;
+thehd_tl = [ -thehd_tr[0], thehd_tr[1] ];
+thehd_bl = -thehd_tr;
+thehd_br = -thehd_tl;
 
 interlock_rad = interlock_dia/2;
 interlock_negative_rad = interlock_rad + 0.125;
@@ -59,9 +63,11 @@ module Posts(posts) {
   }
 }
 
-module TileBase(botleft_post, topright_post){
-  botleft = botleft_post - thehd;
-  size = topright_post - botleft_post + thehd * 2;
+module TileBase(botleft, topright){
+  size = topright - botleft;
+  botleft_post = botleft + thehd_tr;
+  topright_post = topright - thehd_bl;
+  echo(botleft_post, topright_post);
   difference(){
     mirror([0,0,1])
       translate(concat(botleft, [0]))
@@ -149,12 +155,19 @@ module Interlock(this_post, right_post) {
     InterlockCore(interlock_rad, 0, 1);
 }
 
+function TestPiece_holes2corners(holes) =
+  [ holes[0] + thehd_bl,
+    holes[1] + thehd_br,
+    holes[0] + thehd_tl,
+    holes[1] + thehd_tr ];
+
 module TestPiece1(){ ////toplevel
   holes = [ [-100, 0],
            [   0, 0]
            ];
+  corners = TestPiece_holes2corners(holes);
   difference(){
-    TileBase(holes[0], holes[1]);
+    TileBase(corners[0], corners[3]);
     InterlockNegative(holes[1], holes[1] + [0,1]);
   }
   Posts(holes);
@@ -167,7 +180,8 @@ module TestPiece2(){ ////toplevel
   holes = [ [   0, 0],
            [  50, 0]
            ];
-  TileBase(holes[0], holes[1]);
+  corners = TestPiece_holes2corners(holes);
+  TileBase(corners[0], corners[3]);
   Posts(holes);
   RoundEdge(holes[0], holes[1]);
   Interlock(holes[0], holes[0] + [0, -1]);