Skip to content

Instantly share code, notes, and snippets.

@ahcurrier
ahcurrier / intersect3spheres.js
Last active April 5, 2024 14:43
Compute the Intersection(s) of 3 Spheres (JavaScript)
/*
Find the intersection(s) (x,y,z) and (x_,y_,z_) of three spheres centered
at (x1,y1,z1), (x2,y2,z2) and (x3,y3,z3) with corresponding radii of r1, r2, and r3
Adapted from http://mathforum.org/library/drmath/view/64311.html
*/
function intersect3spheres(x1, x2, x3, y1, y2, y3, z1, z2, z3, r1, r2, r3) {
var a1, b1, c1, k1, a3, b3, c3, k3, a31, b31,