[Home] [Puzzles & Projects] [Delphi Techniques] [Math Topics] [Library] [Utilities]
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:
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
Non-programmers are welcome to read on, but may want to jump to bottom of this page to download the executable program now.
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. .
Suggestions for Further Explorations
Copyright © 2000-2013, Gary Darby
All rights reserved.