# Reasonably-Good Bounding Sphere of an Affine-Transformed Sphere

I have a unit sphere transformed by a given $4\times 4$ affine transform (it is a 3D transform; using homogenous coordinates with $w=1$ allows representing translation).

I now need to calculate a bounding sphere of this transformed sphere. How can I do this?

For completeness, I should mention I've thought of some bad ways to do it.

For example, one could take the sphere's axis-aligned bounding box, transform that, and then compute the minimal bounding sphere of those 8 points. This is unsatisfactory because the bounding sphere will be very coarse. E.g. if the transform were the identity, we can see that the new bounding sphere will have $3 \sqrt{3} ~\times$ the volume.

So as additional requirements: the preferred method will produce a fairly tight bounding sphere and also be reasonably simple ($O(1)$ time, small constant).

## 1 Answer

Okay, well I thought about it some more, and it's actually pretty easy. Here are some algorithms, all of which produce the optimal bounding sphere:

1. In your example, don't consider the axis-aligned box's corners. Consider its face-centers.

2. As a refinement of this, forward transform the origin as well as the points $<1,0,0>, <0,1,0>, <0,0,1>$. The transformed origin is the center of the new bounding sphere, and the longest vector from the transformed origin to one of those transformed points is the radius.

3. Decompose matrix into position/rotation/scale. As a commenter mentioned one can use SVD, but because it's affine, there's also an easier way. Then the radius of the bounding sphere is the max scaling along any axis, and the position is the translation (or you can find it by forward-transforming the origin).

• This is incorrect. None of your proposed methods work for the transformation $\begin{bmatrix}1&1&0&0\\0&0&0&0\\0&0&1&0\\0&0&0&1\end{bmatrix}$, for which you will estimate a radius of $1$ instead of $\sqrt2$. Ultimately, this is because you assume that the matrix can be decomposed as $TRS$, but this one cannot. Most affine transformation matrices are of the form $TR_1SR_2$, which is precisely what the SVD of the $3\times3$ block gives you. (While the above transformation is singular, most invertible transformations will also work. This is just the easiest to work out by hand.) – Rahul Apr 29 '18 at 5:28