Function Repository Resource:

CircleIntersection

Source Notebook

Find the intersection of two circles

Contributed by: Ed Pegg Jr

ResourceFunction["CircleIntersection"][Circle[p,r],Circle[q,s]]

finds the intersection of the circles centered at p with radius r and centered at q with radius s.

Details

ResourceFunction["CircleIntersection"][{p,r},{q,s}] is equivalent to ResourceFunction["CircleIntersection"][Circle[p,r],Circle[q,s]].

Examples

Basic Examples (3) 

Find the intersection of two circles:

In[1]:=
ResourceFunction["CircleIntersection"][Circle[{1, 0}, 4], Circle[{0, 8}, 7]]
Out[1]=

The centers and radii can also be used:

In[2]:=
ResourceFunction["CircleIntersection"][{{1, 0}, 2}, {{0, 4}, 5}]
Out[2]=

Graphic of the circle and intersection points:

In[3]:=
{Graphics[{Circle[{1, 0}, 4], Circle[{0, 8}, 7], {Directive[Red, PointSize[0.03]], ResourceFunction["CircleIntersection"][Circle[{1, 0}, 4], Circle[{0, 8}, 7]]}}], Graphics[{Circle[{1, 0}, 2], Circle[{0, 4}, 5], {Directive[Red, PointSize[0.03]], ResourceFunction["CircleIntersection"][Circle[{1, 0}, 2], Circle[{0, 4}, 5]]}}]} // GraphicsRow
Out[3]=

Scope (1) 

Use with inexact coordinates:

In[4]:=
ResourceFunction["CircleIntersection"][Circle[{0.3, 0.}, 0.7], Circle[{1., 1.}, 1.3]]
Out[4]=

Applications (3) 

This function returns cleaner results when variables are used:

In[5]:=
ResourceFunction["CircleIntersection"][{{1, \[Phi]}, 1}, {{z, 0}, 2}]
Out[5]=

BooleanRegion remains unevaluated:

In[6]:=
BooleanRegion[#1 && #2 &, {Circle[{1, \[Phi]}, 1], Circle[{x, 0}, 2]}]
Out[6]=

Here are two equivalent ways to use Solve:

In[7]:=
{a, b} /. RootReduce[
  Solve[{EuclideanDistance[{a, b}, {1, \[Phi]} ] == 1, EuclideanDistance[{a, b}, {x, 0} ] == 2}, {a, b}]]
Out[7]=
In[8]:=
{x, y} /. Solve[{x, y} \[Element] Circle[{1, \[Phi]}, 1] && {x, y} \[Element] Circle[{x, 0}, 2], {x, y}]
Out[8]=

Properties and Relations (3) 

Find the intersection of two circles:

In[9]:=
ResourceFunction["CircleIntersection"][Circle[{1, 0}, 2], Circle[{3, 3}, 3]]
Out[9]=

RegionIntersection gives the same answer:

In[10]:=
RegionIntersection[Circle[{1, 0}, 2], Circle[{3, 3}, 3]]
Out[10]=

BooleanRegion also gives the same answer:

In[11]:=
BooleanRegion[#1 && #2 &, {Circle[{1, 0}, 2], Circle[{3, 3}, 3]}]
Out[11]=

Possible Issues (4) 

Some intersection points are nice:

In[12]:=
ResourceFunction["CircleIntersection"][{{0, 1}, 2}, {{2, 2}, 1}]
Out[12]=

More often the intersection points are messier:

In[13]:=
ResourceFunction["CircleIntersection"][{{0, 1}, 2}, {{2, 2}, 4}]
Out[13]=

When the distance between centers is equal to the sum of the radii (i.e. the two circles are mutually externally tangent), or if one circle is internally tangent to the other, the returned points will be identical:

In[14]:=
ResourceFunction["CircleIntersection"][{{0, 1}, 2}, {{3, 1}, 1}]
Out[14]=
In[15]:=
ResourceFunction["CircleIntersection"][{{0, 0}, 2}, {{1, 0}, 1}]
Out[15]=

When the distance between centers exceeds the sum of the radii, or if one circle is completely inside the other, the returned points can be complex-valued:

In[16]:=
ResourceFunction["CircleIntersection"][{{0, 1}, 2}, {{5, 1}, 1}]
Out[16]=
In[17]:=
ResourceFunction["CircleIntersection"][{{0, 0}, 3}, {{1, 1}, 1}]
Out[17]=

When distance between points is zero (i.e. the circles are concentric), an empty list is returned:

In[18]:=
ResourceFunction["CircleIntersection"][{{1, 6}, 6}, {{1, 6}, 1}]
Out[18]=

Version History

  • 1.0.1 – 31 August 2021
  • 1.0.0 – 01 February 2021

Related Resources

License Information