function soddyCircles([x1, y1, r1], [x2, y2, r2], [x3, y3, r3]) {
if (r2 < r1) [x1, y1, r1, x2, y2, r2] = [x2, y2, r2, x1, y1, r1];
if (r3 < r2) [x2, y2, r2, x3, y3, r3] = [x3, y3, r3, x2, y2, r2];
const [ri, ro] = soddyRadii(r1, r2, r3);
const [xi0, yi0, xi1, yi1] = circleIntersections([x1, y1, r1 + ri], [x2, y2, r2 + ri]);
const [xo0, yo0, xo1, yo1] = circleIntersections([x1, y1, r1 + ro], [x2, y2, r2 + ro]);
const i0 = (xi0 - x3) ** 2 + (yi0 - y3) ** 2;
const i1 = (xi1 - x3) ** 2 + (yi1 - y3) ** 2;
const o0 = (xo0 - x3) ** 2 + (yo0 - y3) ** 2;
const o1 = (xo1 - x3) ** 2 + (yo1 - y3) ** 2;
return [
i0 < i1 ? [xi0, yi0, ri] : [xi1, yi1, ri],
o0 < o1 ? [xo0, yo0, Math.abs(ro)] : [xo1, yo1, Math.abs(ro)]
];
}