chiark / gitweb /
fairphone-case: introduce RearCameraAperture (nfc)
[reprap-play.git] / fairphone-case.scad
index 9fe2984b92db2e724c30b546a69030bb50e05c77..9ae36f0db75e4be5004be745d95f44091e3429a9 100644 (file)
@@ -332,6 +332,24 @@ module Struts(x_start, z_min, th){
   }
 }
 
+module RearSpeakerAperture(){
+  CaseBase_rhsflip([1]) CaseBase_botflip([1])
+    linextr(-20, 20)
+    mirror([0,1])
+    translate(rearspeaker_pos_bl + bumper)
+    rectfromto(-rearspeaker_gap,
+              rearspeaker_size + rearspeaker_gap);
+}
+
+module RearCameraAperture(){
+  CaseBase_rhsflip([1])
+    mirror([0, 0, 1])
+    linear_extrude(height = 20)
+    mirror([0, 1, 0])
+    translate(bumper)
+    rectfromto(camera_pos_tl, camera_pos_br);
+}
+
 module CaseBase(){
   AroundEdges(epp3[1], case_th_bottom, 1)
     EdgeProfile();
@@ -370,12 +388,7 @@ module Case(){ ////toplevel
       }
 
     // front camera
-    CaseBase_rhsflip([1])
-      mirror([0, 0, 1])
-      linear_extrude(height = 20)
-      mirror([0, 1, 0])
-      translate(bumper)
-      rectfromto(camera_pos_tl, camera_pos_br);
+    RearCameraAperture();
 
     // struts (invisible, because they're buried in the case)
     Struts(epp2i[0], epp2i[1] - case_th_bottom, case_th_bottom);
@@ -403,13 +416,7 @@ module Case(){ ////toplevel
     CaseBase_rhsflip([1])
       CaseAperture(noisecancelmic_pos, noisecancelmic_dia, 20);
 
-    // rear speaker
-    CaseBase_rhsflip([1]) CaseBase_botflip([1])
-      linextr(-20, 20)
-      mirror([0,1])
-      translate(rearspeaker_pos_bl + bumper)
-      rectfromto(-rearspeaker_gap,
-                rearspeaker_size + rearspeaker_gap);
+    RearSpeakerAperture();
   }
 }
 
@@ -471,7 +478,15 @@ module TestSelectCamera(){
     linear_extrude(height = 50)
     mirror([0, 1, 0])
     rectfromto([-20, -20],
-              camera_pos_br + bumper + [ 5, 5 ]);
+              camera_pos_br + bumper + [ 2, 2 ]);
+}
+
+module TestSelectRearSpeaker(){
+  minkowski(){
+    RearSpeakerAperture();
+    translate([20, 0,0])
+      cube([42, 2, 1], center=true);
+  }
 }
 
 module TestCamera(){ ////toplevel
@@ -531,6 +546,7 @@ module TestFrameCase(){ ////toplevel
     union(){
       TestSelectFrame();
       TestSelectCamera();
+      TestSelectRearSpeaker();
     }
   }
 }