How to determine the angle of intersection? (2 circles)

1k Views Asked by At

Here's an example of what I have:

enter image description here

The radius of both circles is 50. Each circle is moved in by 10, so the distance between the two center points is 80.

As you can see one of the circles end at 90 degrees and one ends at 270 degrees.

How can I figure out what degree the 2 lines intersect on, that way I know when to cut off the lines?

Here's how my code looks, just incase it's of any help:

c.beginPath();
c.arc(160,250,50,0,(Math.PI/180)*-225,true);
c.lineTo(200,350);
c.lineTo(260,300);
c.arc(240,250,50,(Math.PI/180)*45,(Math.PI/180)*180,true);
c.stroke();

The arcs work like this: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/arc

2

There are 2 best solutions below

0
On BEST ANSWER

$$ y=\cos^{-1}(40/50)\approx36.8698976458\deg\approx0.643501108793\operatorname{rad} $$ This is a 3-4-5 triangle, so $ x=30 $

8
On

Draw a right triangle with vertices at the center of one circle, the intersection point of the circles, and the midpoint directly between the two centers. That's a 30-40-50 right triangle. From there you have the angles from the definitions of sine and cosine.