+module ButtonCoverProfile(){
+ intersection(){
+ polygon([ bppM, bppP, bppO, bppJ, bppL, bppK ]);
+ hull(){
+ EdgeProfile();
+ LidEdgeProfile();
+ }
+ }
+}
+
+module ButtonPlan(l, deep, cut){
+ bigger =
+ (deep ? lid_buttoncover_overlap : 0) +
+ (cut ? 0 : -lid_buttoncover_gap);
+
+ d_D1_y =
+ (cut ? 0 : lid_buttoncover_gap);
+
+ C = [0,0]; // by definition
+ T = [ 0, epp4[1] ];
+ G = T + [0,10];
+ B0 = C + [0,-1] * button_cutout_depth;
+ r0 = 0.5 * (T[1] - B0[1]);
+ A = [ -(l + button_l_fudge)/2 + r0, 0.5 * (T[1] + B0[1]) ];
+ r1 = r0 + bigger;
+ // | D1 - A | = r1 * 2
+ // 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];
+
+ hull(){
+ for (m=[0,1]) mirror([m,0])
+ circleat(A, r1);
+ }
+ for (m=[0,1]) mirror([m,0]) {
+ difference(){
+ polygon([ E1,
+ A,
+ B0,
+ G,
+ F1,
+ D1
+ ]);
+ circleat(D1, r1);
+ }
+ }
+}
+