chiark / gitweb /
fairphone-case: ButtonPlan new approach
[reprap-play.git] / fairphone-case.scad
index 14db4f8705f8747316e7259d12629cc7f1daca44..f0de5d9a390753e2c801652eef38be31dc70f08f 100644 (file)
@@ -138,7 +138,7 @@ module ButtonCoverProfile(){
   }
 }
 
-module ButtonPlan(l, bigger){
+module ButtonPlan(l, bigger, d_D1_y){
   C = [0,0]; // by definition
   T = [ 0, epp4[1] ];
   G = T + [0,10];
@@ -147,10 +147,11 @@ module ButtonPlan(l, bigger){
   A = [  -l/2 + r0, 0.5 * (T[1] + B0[1]) ];
   r1 = r0 + bigger;
   // | D1 - A | = r1 * 2
-  // D1_y = T_y - r1
-  // =>    4 * r1^2   =  (r1-r0)^2 + (D1_x - A_x)^2
-  // =>    D1_x =  A_x + v/~ [  4 * r1^2   -   (r1-r0)^2 ]
-  D1  = [ A[0] + sqrt( 4*r1*r1 - bigger*bigger ),  T[1] - r1 ];
+  // D1_y = T_y - r1 + d_D1_y
+  // =>    4 * r1^2   =  (r1-r0 + d_D1_y)^2 + (D1_x - A_x)^2
+  // =>    D1_x =  A_x + v/~ [  4 * r1^2   -   (r1-r0 + d_D1_y)^2 ]
+  D1  = [ A[0] + sqrt( 4*r1*r1 - pow(bigger + d_D1_y, 2) ),
+         T[1] - r1 + d_D1_y ];
   E1  = 0.5 * (D1 + A);
   F1  = D1 + [0,10];
 
@@ -351,7 +352,8 @@ module ButtonPlanForDemo(colour, z, gap, overlap){
     translate([0,0,z])
     ButtonPlan(8,
               lid_buttoncover_gap * gap +
-              lid_buttoncover_overlap * overlap);
+              lid_buttoncover_overlap * overlap,
+              lid_buttoncover_gap * (1-gap));
 }
 
 module DemoProfiles(){ ////toplevel
@@ -372,7 +374,7 @@ module DemoProfiles(){ ////toplevel
     }
   }
 
-  translate([-40,0]) {
+  translate([-20,0]) {
     ButtonPlanForDemo("blue",    0, 0,0);
     ButtonPlanForDemo("red",    -1, 1,0);
     ButtonPlanForDemo("yellow", -2, 0,1);