Circle from 3 points

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




Search only

Support DFF

 If you shop at Amazon anyway,  consider using this link. We receive a few cents from each purchase.   Thanks.


Support DFF

 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.


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

Search only



Three points on a plane define a unique circle.  Here's the logic and some code to determine the locations and size of the circle.

I won't  include all of the details for the methods - excellent web page references and sample Delphi code with all the details are included below.      But here's an outline.

First - to determine the center point:

bulletGiven points P1, P2, and P3, determine the center point of the circumscribed circle (the smallest circle that encloses the 3 points).  Lets assume that the points are connected, we'll call the lines P1-P2, P2-P3 and P3-P1.     
bulletConstruct the perpendicular bisectors of  lines P1-P2 and P2-P3.   If either of these lines is vertical (infinite slope), just renumber the points so that the vertical line is excluded.     
bulletThe lines intersect at the desired point.  The geometrical solution ends here. For the algebraic solution we need to solve the equations of the bisectors to find the center point.  From there the radius can be determined using the Pythagorean theorem to calculate the distance from the center to any of the other points. 
bulletHere's a reference page
bulletYou can click below to download a sample Delphi Circle3Point project which uses  the GetCenter function. 

Alternatively, if just the radius is required:

bulletIf a, b and c are the lengths of the sides and K is the area of the given triangle then the radius oft he circumscribed circled is given by :   This surprising equation is derived  here .  The derivation is not difficult,  but it is not intuitively obvious  that the radius of a circle circumscribed around a triangle should be equal to the product of the side lengths divided by 4 times the area.    It does work though, as illustrated in function GetRadius in the sample code.

The sample program measures the execution times for the 2 functions - GetRadius is about twice as fast as GetCenter.  (60 microseconds vs. 140 on my new 800mhz Celeron).   QueryPerformanceCounter and QueryPerformanceFrequency functions are used to get accurate timings.   To use the program, just click 3 points on the image area and see the enclosing circle.  

Addendum Sept. 3, 2003:  A viewer noticed that the Y coordinate in this program increased in the downward direction.  This is inherent in computer graphics devices and normal for programmers, but not for the rest of the population.   I fixed the program today  to put the (0,0) coordinate in the bottom left corner where it  belongs. 

Addendum December 27, 2009:  Version 2 of the program was posted today.  It adds the ability for user input of the 3 required points using floating point values of arbitrary scale.  The feature was added to help solve a specific problem (Problem 9, The Pot on the Crosspieces", from the book  "Mathematical Mind Benders" Stephen Barr, Dover Publications.  A pot rests on two steel bars connected at right angles with the diameter of the pot intersecting one bar at 6 and 15 inches from one end and intersecting the 2nd bar at a point 8 inches from the 1st bar.  The question is: "What is the diameter of the pot?".  (Answer 21.25 inches if you want to check.)  

Running/Exploring the Program 

bulletDownload source
bulletDownload  executable


Created Sept 28, 2001

Modified June 03, 2011




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