In this case, we'll simply average the coordinates. Loop through the coordinates and find the maximum distance from the center. This is the radius. This is to eliminate the use of a costly square root function for each point in the mesh. You will see similar optimizations later, including the comparison of the square of a vectors length versus the square of the value we wish to compare the length to.
Multiplication is orders of magnitude faster than finding a square root.
To gain a quick understanding of this problem, let's take a look at what happens when two spheres are touching. As you can see in the illustration to the right, the radius of each sphere now also defines the distance its center to the opposite sphere's skin. If the distance were greater, the two spheres would not touch. If it were less, the spheres would intersect. Below are two functions that perform this test.