mono/MonoGame — pull request #3162 by nkast (2014-11-09 01:48:59+00:00)
Title: fix BoundingSphere.CreateFromPoints

I tested this with the 8 points of https://github.com/mono/MonoGame/pull/3161 and one bigger mesh with 5994 vertices.

(XNA) 8 points
center:{X:823,1906 Y:132,5079 Z:385,9665}, radius:836,4782
(MG) 8 points
center:{X:823,1906 Y:132,5079 Z:385,9664}, radius:836,4782

(XNA) 5994 points
center:{X:0,08363384 Y:0,4405774 Z:-0,1779203}, radius:1,762063
(MG) 5994 points
center:{X:0,08363384 Y:0,4405774 Z:-0,1779203}, radius:1,762063

Initially I re-implemented this by following recipes from a book (principal axis, eigenvectors, etc). Then I copied the final stage of the algorithm to the old implementation to compare results. The new implementation was worst in both performance & sphere size so I throw it way. 8-(
The good news is the old implementation was solid, just missing one final step.

Related:
https://github.com/mono/MonoGame/issues/3030
https://github.com/mono/MonoGame/pull/3161