Find circles that are tangent to three given circles (Apollonius’ Problem) in C#

[Apollonius' Problem]

Given three objects that can be a point, line, or circle, you can try to draw circles that are tangent to each. The case using three circles is called Apollonius’ Problem. Originally these problems were studied by Euclid (ca. 300 BC) and Apollonius of Perga (ca. 262 BC – ca. 190 BC) and they were solved geometrically with straight edge and compass.

This example solves Apollonius’ Problem by finding solutions to the three following equations algebraically.

    (X - X1)2 + (Y - Y1)2 = (R ± R1)2
    (X - X2)2 + (Y - Y2)2 = (R ± R2)2
    (X - X3)2 + (Y - Y3)2 = (R ± R3)2

Unfortunately solving the equations requires dividing by some terms that may be zero and in those cases the solution doesn’t work. In some cases that’s because some solutions are degenerate. For example, suppose the three circles have the same radii and are all tangent to the X axis. Then two of the tangent “circles” are actually lines, one along the X axis and one parallel to the X axis on the other side of the circles.

In other cases the division by zero seems to be caused by the method for solving the equations and real solutions do exist. This is a tricky problem and I haven’t yet found a solution. If you figure out how to solve these equations without these problems, please let me know.

For more discussion of the problem and how to solve the equations, see:

See the code for additional details about how this program works.

Download Example   Follow me on Twitter   RSS feed   Donate

This entry was posted in algorithms, drawing, graphics, mathematics and tagged , , , , , , , , , , , , , . Bookmark the permalink.

16 Responses to Find circles that are tangent to three given circles (Apollonius’ Problem) in C#

  1. Pingback: Draw an Apollonian gasket in C# - C# HelperC# Helper

  2. Pingback: ゼロ除算(division by zero)1/0=0/0=z/0= tan (pi/2)=0 | rkernel

  3. Pingback: 令和(れいわ) | rkernel

  4. Pingback: 世界を一変させた発見や科学技術の初版本およそ130冊!「世界を変えた書物」展 | rkernel


  6. Pingback: マサキ※音楽と映像作る人‏ @YMZnoMASAKI 9時間9時間前その他▼文系にも判る優しいゼロ除算4個のリンゴを0人で分けて下さい↓まず言葉がおかしいです。なり立たない文章なので数式定義もお

  7. Pingback: 再生核研究所、ゼロ除算の発見とゼロ除算算法の発見2014年2月2日、2014年3月8日 | rkernel

  8. Pingback: 0/0=0 はゼロと算術の発見者によって1300年も前に知られていました。1/0=0 は2000年以上の歴史が有って、6年前に発見されました。ご覧あれ: | rkernel

  9. Pingback: Timeline of scientific discoveries | rkernel

  10. Pingback: 1992年10月31日 ガリレオの死から350年目。 | rkernel

  11. Pingback: 「0÷4=0」が示されているのに、「4÷0」について疑問を持つ子どもが一人もいない、なんてことがあるだろうか。 | rkernel

  12. Pingback: The real problem behind Russell’s paradox – Utrecht … › bitstream › handle PDFこのページを訳す LM Geerdink 著 – ‎2012 – ‎関連記事 world-class caliber like Ernst Zermelo, Kurt Gödel an

  13. Pingback: To infinity and beyond #BlackHole #ethblackhole Einstein & Stephen “Black holes are where God divided by zero” | rkernel

  14. Pingback: Division With Zero | Why any number divided by Zero is not Defined ? | rkernel

  15. Pingback: #Divisionbyzero #Division #understanddivision Understand division by zero | Basic concept | 3 min bite | rkernel

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.