db5191b3e76d — Chris Cannam tip 3 years ago
Find proper tangent points for top of lens mount
2 files changed, 18 insertions(+), 5 deletions(-)

M cover.sml
M cover.svg
M cover.sml +17 -4
@@ 4,6 4,17 @@ open SvgPathShorthand
 fun main () =
     let val lens_radius = 31.6
         val lens_centre_height = 31.9
+        val flat_top_half_width = 26.3
+
+        (* calculate tangent *)
+        val b = Math.sqrt (flat_top_half_width * flat_top_half_width +
+                           lens_centre_height * lens_centre_height)
+        val beta = Math.acos (lens_centre_height / b)
+        val gamma = Math.acos (lens_radius / b)
+        val alpha = Math.pi / 2.0 - beta - gamma
+        val tangent_elevation = lens_radius * Math.sin alpha
+        val tangent_offset = lens_radius * Math.cos alpha
+
         val document =
             { size = (200.0, 200.0),
               content = [

          
@@ 24,10 35,12 @@ fun main () =
                         (RECT { origin = (0.0, 12.0),
                                 size = (57.0 + 2.0 * lens_radius + 43.0,
                                         43.0) }, []),
-                        (PATH [ M (57.0, lens_centre_height),
-                                L [(57.0 + lens_radius - 26.3, 0.0),
-                                   (57.0 + lens_radius + 26.3, 0.0),
-                                   (57.0 + 2.0 * lens_radius, lens_centre_height)] ], []),
+                        (PATH [ M (57.0 + lens_radius - tangent_offset,
+                                   lens_centre_height - tangent_elevation),
+                                L [(57.0 + lens_radius - flat_top_half_width, 0.0),
+                                   (57.0 + lens_radius + flat_top_half_width, 0.0),
+                                   (57.0 + lens_radius + tangent_offset,
+                                    lens_centre_height - tangent_elevation)] ], []),
                         (CIRCLE { centre = (49.0, 12.0 + 15.0),
                                   radius = 1.25 }, []),
                         (CIRCLE { centre = (49.0, 12.0 + 43.0 - 13.0),

          
M cover.svg +1 -1
@@ 7,7 7,7 @@ 
 </g>
 <g stroke="black" stroke-width="0.1" fill="none" transform="translate(20,120)"><circle cx="88.6" cy="31.9" r="31.6"/>
 <rect x="0" y="12" width="163.2" height="43"/>
-<path d="M 57,31.9 L 62.3,0 114.9,0 120.2,31.9"/>
+<path d="M 57.5134853607,26.2264995302 L 62.3,0 114.9,0 119.686514639,26.2264995302"/>
 <circle cx="49" cy="27" r="1.25"/>
 <circle cx="49" cy="42" r="2.5"/>
 <rect x="159.7" y="7.5" width="3.5" height="4.5"/>