"Given two circles C1(x1,y1,r1) and C2(x2,y2,r2) that either touch externally or do not…
- User
"Given two circles C1(x1,y1,r1) and C2(x2,y2,r2) that either touch externally or do not intersect, and a path P0-P1-P2-P3 where:
P1 is on C1's circumference P2 is on C2's circumference C1 is positioned to maximally overlap angle P0P1P2 C2 is positioned to maximally overlap angle P1P2P3
Find the coordinates of one point where the common external tangent line P10P20 touches either circle, where P10 is on C1 after P1 (following the path direction) and P20 is on C2 before P2. Provide a simple, flexible algorithm or equation, with proof, and Javascript implementation. The solution should handle all cases, including when radii are equal and when circles touch."
Assistant
Here's a simple algorithm to find the coordinates of the external tangent point on one of the circles given the following conditions:
- Given two circles C1(x1, y1, r1) and C2(x2, y2, r2)
- Given a path P0-P1-P2-P3 where P1 is on C1's circumference and P2 is on C2's circumference.
- C1 is positioned to maximally overlap angle P0P1P2
- C2 is positioned to maximally overlap angle P1P2P3
- P10 is on C1 after P1 (following the path direction) and P20 is on C2 before P2.
Algorithm:
- Calculate the angle θ between the line segments P0P1 and P1P2.