Intersecting Circle Centers

[Home]   [Puzzles & Projects]    [Delphi Techniques]   [Math topics]   [Library]   [Utilities]

 

 

Search

Search WWW

Search DelphiForFun.org

As of October, 2016, Embarcadero is offering a free release of Delphi (Delphi 10.1 Berlin Starter Edition ).     There are a few restrictions, but it is a welcome step toward making more programmers aware of the joys of Delphi.  They do say "Offer may be withdrawn at any time", so don't delay if you want to check it out.  Please use the feedback link to let me know if the link stops working.

 

Support DFF - Shop

 If you shop at Amazon anyway,  consider using this link. 

     

We receive a few cents from each purchase.  Thanks

 


Support DFF - Donate

 If you benefit from the website,  in terms of knowledge, entertainment value, or something otherwise useful, consider making a donation via PayPal  to help defray the costs.  (No PayPal account necessary to donate via credit card.)  Transaction is secure.

Mensa® Daily Puzzlers

For over 15 years Mensa Page-A-Day calendars have provided several puzzles a year for my programming pleasure.  Coding "solvers" is most fun, but many programs also allow user solving, convenient for "fill in the blanks" type.  Below are Amazon  links to the two most recent years.

Mensa® 365 Puzzlers  Calendar 2017

Mensa® 365 Puzzlers Calendar 2018

(Hint: If you can wait, current year calendars are usually on sale in January.)

Contact

Feedback:  Send an e-mail with your comments about this program (or anything else).

Search DelphiForFun.org only

 

 

 

Problem Description

This program ...

Background & Techniques

A previous Intersecting Circles program investigated how to determine the area enclosed by the intersection of 2 circles of known size and displacement from their centers.i

I received this email a few weeks ago:

Intersecting circle coordinates
From: michael.XXXXXX@XXXXXXXXX.com
Contact Requested - Wednesday, August 29, 2012 04:47 PM

Hello and thank you for the great webpage!
Question: Is there a formula to determine the X,Y coordinates of two intersecting circles when you know:
1) the area of circle A (or radius) 2) the area of circle B (or radius) 3) the area of the intersection
Assume: 1) center of circle A = (0,0)
2) center of circle B = (x1,0) (i.e. on same plane)
3) 0 < radius(A) < x1 (meaning circle B is not inside circle A)
Thanks for your consideration!

 

So now the problem is to determine the distance between the centers of two given circles if the intersection area in known.

In researching my reply, I found this relevant formula for the area of intersection when the two radii and the distance between circle centers is known. It is equation #14 on the Wolfram page at  http://mathworld.wolfram.com/Circle-CircleIntersection.html.

A=area of intersection, r1, R2 = radii of the two circles, d= the distance between the two circle centers

A= sqr(r1)*arccos((sqr(d)+(+sqr(r1)-sqr(R2))/(2*d*r1)) + sqr(R2)*arccos((sqr(d)+sqr(R2)-sqr(r1))/(2*d*R2))
- 0.5*sqrt((-d+r1+R2)*(d+r1-R2)*(d-r1+R2)*(d+r1+R2))


It doesn't seem feasible to directly solve the "Area" equation for d, but given an Area and any 2 of the other 3 variables, we can solve for the other by iterating on that variable and finding the minimum error between the calculated and given areas.

The program allows entering  any 3 of the 4 variables and click the radio button for the 4th to compute its value. If the missing value is not "Area",it is incremented from the lowest legal value until the calculated area matches the given area. An animation of interim results are displayed, if the animation runs too slowly, increase the resolution or uncheck an "Animation" checkbox..
 

Non-programmers are welcome to read on, but may want to jump to bottom of this page to download the executable program now.

Programmer's Notes:

If Area is the parameter to be calculated, the equation above may be applied directly.   The general technique for the other cases start with a guess the for target variable (one of the two radii or the distance between centers), which is known to be too small and increase it in small steps in a loop comparing the test area at each step with the known area value.  We expect the difference to decrease as our guesses approach the target.  We'll stop the loop when the error starts increasing again indicating the previous guess is the closest value we can achieve.  .

There are  extra tests required to detect unsolvable cases, and there may be more  not yet handled.

The use of radio buttons to select the parameter to be calculated  may not have been the best choice.   In order to recalculate the previous selection,  the button must be turned off but setting the  Checked property to false inside of the OnClick exit , triggers another call to the exit which has Check flipped back to true before calling.  The solution was to set OnClick to Nil, before changing the Checked property, calling Application.Processmessages to register the the change,  and then replacing the original OnClick exit  value - a little cumbersome and not very neat.  .   

Running/Exploring the Program 

bulletDownload  executable
bullet Download source 

 

Suggestions for Further Explorations

???
   
   

 

Original:  October 5, 2012

Modified:  May 15, 2018

 
  [Feedback]   [Newsletters (subscribe/view)] [About me]
Copyright © 2000-2018, Gary Darby    All rights reserved.