## «« Site Rescued »»

While the site is still going to move from its current host, a new site will now take its place. More Info.

The new site may have less content, but the core will now remain. And it will now play nicely with phones! Keep an eye on the DelphiDabbler Blog for news.

» Help

# How to generate a circle through three points

Let the three given points be a, b, c. Use x and y subscripts represent x and y coordinates, so that the x and y co-ordinates of a are ax and ay.

The coordinates of the center p = (px, py) of the circle determined by a, b, and c are:

```A = bx - ax
B = by - ay
C = cx - ax
D = cy - ay
E = A × (ax + bx) + B × (ay + by)
F = C × (ax + cx) + D × (ay + cy)
G = 2 × (A × (cy - by) - B × (cx - bx))
px = (D × E - B × F) ÷ G
py = (A × F - C × E) ÷ G```

If G is zero then the three points are collinear and no finite-radius circle through them exists. Otherwise, the radius of the circle is:

`r2 = (ax - px)2 + (ay - py)2`
Original resource: The Delphi Pool Joseph O'Rourke 2009-11-06 2009-11-06