--- ---

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: