I have a sphere represented in object space by a center point and a radius. The sphere is transformed into world space with a transformation matrix that may include scales, rota
@comingstorm's answer is great but can be simplified a lot. If M
is the sphere's transformation matrix, indexed from 1, then
x = M[1,4] +/- sqrt(M[1,1]^2 + M[1,2]^2 + M[1,3]^2)
y = M[2,4] +/- sqrt(M[2,1]^2 + M[2,2]^2 + M[2,3]^2)
z = M[3,4] +/- sqrt(M[3,1]^2 + M[3,2]^2 + M[3,3]^2)
(This assumes the sphere had radius 1 and its center at the origin before it was transformed.)
I wrote a blog post with the proof here, which is much too long for a reasonable Stack Overflow answer.