Circles and with .

The cases

ConditionResult
separate — 0 points
externally tangent — 1 point
2 points
, internally tangent — 1 point
one inside the other — 0 points
, identical — infinitely many

Test with squared distances to stay exact: compare against and .

The construction

Both intersection points lie on the radical line, perpendicular to . Let

Then the base point is with , and the intersections are .

vector<PD> circleCircle(PD c1, double r1, PD c2, double r2) {
    PD u = c2 - c1;
    double d2 = norm2(u), d = sqrt(d2);
    if (d < EPS) return {};                                  // concentric
    if (d > r1 + r2 + EPS) return {};
    if (d < fabs(r1 - r2) - EPS) return {};
 
    double a = (d2 + r1*r1 - r2*r2) / (2 * d);
    double h2 = r1*r1 - a*a;
    PD base = c1 + u * (a / d);
    if (h2 < EPS) return {base};                             // tangent
    double h = sqrt(h2);
    PD perpU{-u.y / d * h, u.x / d * h};
    return {base - perpU, base + perpU};
}

The radical line and radical centre

The radical axis of two circles is the locus of points with equal power to both:

Setting the two powers equal gives a line (the terms cancel):

For three circles the three radical axes meet at the radical centre — the point from which tangent lengths to all three are equal. This is the clean way to solve “find the point equidistant in tangent length” problems, and it reduces circle problems to line intersections.

Areas

Lens (intersection) area of two overlapping circles:

with and symmetrically for .

Union of circles: for each circle, walk its boundary and determine which arcs are not covered by any other circle; then apply a Green’s theorem style sum over arcs and chords. .

TaskMethod
Circle through 3 pointsperpendicular bisectors, or the determinant formula
Circle tangent to 2 circles with radius intersect circles of radii and
Apollonius circlethe locus with
Common tangent linessee the tangents page
Circle inversionmaps circles and lines to circles and lines
Smallest enclosing circleWelzl

Precision

Near-tangency

When is close to , is a tiny difference of large numbers and loses most of its significant digits. Always clamp with max(0.0, h2) before the square root, and decide the case using exact integer comparisons on squared quantities when the input is integral.

See also: Circle-Line Intersection · Tangents · Minimum Enclosing Circle