How to join overlapping circles?

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

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

\"AltText\"

becomes

3条回答
  •  孤独总比滥情好
    2021-02-02 11:58

    Don't have the time to solve it right now. But I'll give you what you need to work it out:

    http://en.wikipedia.org/wiki/Triangle#The_sine.2C_cosine_and_tangent_rules

    In the picture on wikipedia you see the triangle A,B,C. Let A be the center of the left circle, B the center of the right circle. And AC the radius of the left circle and BC the radius of the right circle.

    alt text

    Then point C would be the top intersection point. The corner in A, α, is half the angle in the left circle.The corner in b, β, half the angle in the right circle. These are the angles you need, right?

    Wikipedia explains further: 'If the lengths of all three sides of any triangle are known the three angles can be calculated.'

    Pseudocode:

    a=radius_a
    b=radius_b
    c=b_x - a_x
    alpha=arccos((b^2 + c^2 - a^2) / (2*b*c)) //from wikipedia
    left_angle=2*alpha
    

    Good luck :)

提交回复
热议问题