Professional Documents
Culture Documents
How To Calculate The Intersection Points of Two Circles
How To Calculate The Intersection Points of Two Circles
The aim of this page is to calculate the coordinates on the intersection points between two circles C1 and C2 .
center of circle C2 is P 2 = (x 2 , y 2 )
radius of circle C1 is r1
radius of circle C2 is r2
Our goal is to calculate the coordinates of the intersection points P3 and P4 as a function of P1 , P2 , r1 and r2 .
https://lucidar.me/en/mathematics/how-to-calculate-the-intersection-points-of-two-circles/ 1/8
4/26/23, 12:02 PM How to calculate the intersection points of two circles |
# Intermediate steps
Here are the intermediate steps for computing the intersection points:
1. Calculating the distance d between circle centers
2. Checking cases
3. Calculating the length of a and b
4. Calculation of h
5. Calculating the coordinates of P5
−
−→ →
6. Calculation of vectors P5 P3 and P5 P4
https://lucidar.me/en/mathematics/how-to-calculate-the-intersection-points-of-two-circles/ 2/8
4/26/23, 12:02 PM How to calculate the intersection points of two circles |
2 2
d = √ (x 2 − x 1 ) + (y 2 − y 1 ) (1)
# Checking cases
According to the values of d , we now have five cases:
if d > r1 + r2 the circles are too far apart and do not intersect;
if d < |r 1 − r 2 | one circle is inside the other and do not intersect;
if d = 0 and r1 = r2 the circles are merged and there are an infinite number of points of intersection;
if d = r1 + r2 there is a single intersection point;
if d < r1 + r2 there are two intersection points.
d > r1 + r2 d < |r 1 − r 2 |
Circles are too far apart and do not intersect One circle is inside the other and do not intersect
d = 0 and r1 = r2 d = r1 + r2
Circles are merged and there are an infinite number of points of intersection There is a single intersection point
https://lucidar.me/en/mathematics/how-to-calculate-the-intersection-points-of-two-circles/ 3/8
4/26/23, 12:02 PM How to calculate the intersection points of two circles |
# Calculating a and b
To calculte the distance a let's start by writing h as a function of a and b . In the right triangles P1 P5 P3 the Pythagorean theorem gives:
2 2 2
r = h + a (2)
1
2 2 2
r2 = h + b (3)
2 2 2 2
r1 − r2 = a − b (4)
2 2 2 2
r1 − r2 = a − b
{ (5)
d = a + b
2 2 2 2
r − r = a − (d − a) (6)
1 2
The –a
2
terms on each side cancel out. You can then solve for a :
2 2 2 2 2
r − r = a − d − a + 2ad
1 2
2 2 2
r − r = −d + 2ad (7)
1 2
2 2 2
2ad = r − r + d
1 2
We get :
2 2 2
r − r + d
1 2
a = (8)
2d
2 2 2
r − r + d
2 1
b = (9)
2d
# Calculation of h
Once a and b are know, it becomes easy to calculate the length h by apoplying the Pythagorean theorem in the right triangles P1 P5 P3
https://lucidar.me/en/mathematics/how-to-calculate-the-intersection-points-of-two-circles/ 4/8
4/26/23, 12:02 PM How to calculate the intersection points of two circles |
2 2 2
r = h + a (10)
1
2 2
h = √r − a (11)
1
# Coordinates of P5
The next step is to calculate the coordinates of P5 .
−
−→ →
Since the vectors P1 P5 and P1 P2 are colinear, we can write:
−
− → a →
P1 P5 = × P1 P2 (12)
d
a
x5 = x1 + × (x 2 − x 1 )
d
(13)
a
y5 = y1 + × (y 2 − y 1 )
d
− → x2 − x1
P1 P2 = ( ) (14)
y2 − y1
By multiplying this vector by a rotation matrix around the z-axis, we can calculate the perpendicular vectors:
Clockwise
⊥↻
− → 0 1 x2 − x1 y2 − y1
P1 P2 = ( ) × ( ) = ( ) (15)
−1 0 y2 − y1 x1 − x2
Counterclockwise
− → 0 −1 x2 − x1 y1 − y2
⊥↺
P1 P2 = ( ) × ( ) = ( ) (16)
1 0 y2 − y1 x2 − x1
−
−
−→ → →
We already calculated the norm of vector ∥P 1 P 2 ∥ = d and norm of vectors ∥P 5 P 3 ∥ = ∥P 5 P 4 ∥ = h .
https://lucidar.me/en/mathematics/how-to-calculate-the-intersection-points-of-two-circles/ 5/8
−
−
−
h
−
−
−
−
−
−→
→
P5 P3
→
P5 P4
→
→
P1 P2
=
=
d
h
d
→
P5 P3
→
× P1 P2
→
P5 P4
→
× P1 P2
=
4/26/23, 12:02 PM
⊥↺
⎛
By applyting the ratio
=
⎛
⎝
h(y 2 − y 1 )
d
d
h(x 1 − x 2 )
h(y 1 − y 2 )
h(x 2 − x 1 )
finally get:
and
⎞
⎞
(18)
(17)
# Intersection points
Once the vectors P5 P3
and P5 P4
⊥
https://lucidar.me/en/mathematics/how-to-calculate-the-intersection-points-of-two-circles/
P3 =
P4 =
⎛
x5 −
⎝y5 +
⎛
x5 +
⎝y5 −
x = x5 ±
y =y 5 ±
⊥↻
P3 and
⎜⎟
How to calculate the intersection points of two circles |
h(y 2 − y 1 )
h(x 2 − x 1 )
h(y 2 − y 1 )
h(x 2 − x 1 )
h(y 2 − y 1 )
h(x 2 − x 1 )
d
P4
⎠
d
⎠
⊥
⎞
and
⊥
(19)
(20)
(21)
6/8
4/26/23, 12:02 PM How to calculate the intersection points of two circles |
___
# Download
Here is the Matlab script used to check the results from this page:
circle_circle_intersection.m
# See also
Calculating the transformation between two set of points
Catmull-Rom splines
Check if a number is prime online
Check if a point belongs on a line segment
Cross product
Common derivatives rules
Common derivatives
Dot product
How to check if four points are coplanar?
Common integrals (primitive functions)
Least square approximation with a second degree polynomial
Least-squares fitting of circles
Least-squares fitting of sphere
The mathematics behind PCA
Online quadratic equation solver
Online square root simplifyer
Sines, cosines and tangeantes of common angles
Singular value decomposition (SVD) of a 2×2 matrix
Tangent line segments to circles
Understanding covariance matrices
Weighted PCA
https://lucidar.me/en/mathematics/how-to-calculate-the-intersection-points-of-two-circles/ 7/8
4/26/23, 12:02 PM How to calculate the intersection points of two circles |
https://lucidar.me/en/mathematics/how-to-calculate-the-intersection-points-of-two-circles/ 8/8