How to join overlapping circles?

后端 未结 3 503
失恋的感觉
失恋的感觉 2021-02-02 11:18

I want to visually join two circles that are overlapping so that

\"AltText\"

becomes

3条回答
  •  眼角桃花
    2021-02-02 11:59

    Phi= ArcTan[ Sqrt[4 * R^2 - d^2] /d ]
    

    HTH!

    Edit

    For two different radii:

    Simplifying a little:

    Phi= ArcTan[Sqrt[-d^4 -(R1^2 - R2^2)^2 + 2*d^2*(R1^2 + R2^2)]/(d^2 +R1^2 -R2^2)]
    

    Edit

    If you want the angle viewed from the other circle center, just exchange R1 by R2 in the last equation.

    Here is a sample implementation in Mathematica:

    f[center1_, d_, R1_, R2_] := Module[{Phi, Theta},
    
       Phi=  ArcTan[Sqrt[-d^4-(R1^2-R2^2)^2 + 2*d^2*(R1^2 + R2^2)]/(d^2 +R1^2 -R2^2)]
    
       Theta=ArcTan[Sqrt[-d^4-(R1^2-R2^2)^2 + 2*d^2*(R1^2 + R2^2)]/(d^2 -R1^2 +R2^2)]
    
       {Circle[{center1, 0}, R1, {2 Pi - Phi,   Phi}], 
        Circle[{d,       0}, R2, {Pi - Theta,  -Pi + Theta}]}
    
       ];
    Graphics[f[0, 1.5, 1, 1]]
    

    alt text

    Graphics[f[0, 1.5, 1, 3/4]]  
    

    alt text

    And...

    ImageMultiply[
     Binarize@FillingTransform[#], 
     ImageResize[Import@
     "http://i305.photobucket.com/albums/nn235/greeneyedgirlox/blondebabybunny.jpg", 
       ImageDimensions@#]] &@
     Rasterize@Graphics[f[0, 1.5, 1, 1], Background -> Black]
    

    alt text

    :)

提交回复
热议问题