+module JoinCircs(jr){
+ // http://mathworld.wolfram.com/Circle-CircleIntersection.html
+ R = tube_or + join_cr;
+ r = lock_or[1] + join_cr;
+ d = dist2d( [0,0], lock_0 );
+ x = (d*d - r*r + R*R) / (2*d);
+ y = sqrt( R*R - x*x );
+
+ echo(lock_0x, lock_0y, R,r, d, x,y);
+
+ for (m=[0,1]) {
+ mirror([m,0]) {
+ rotate(atan2(lock_0y, lock_0x)) {
+ translate([x,-y])
+ circle(r= jr);
+ }
+ }
+ }
+}
+