title: Fitting an ellipsoid to 3D data points
body: <p>I have a large set of 3D data points to which I want to fit to an ellipsoid.</p>
  
  <p>My maths is pretty poor, so I'm having trouble implementing the least squares method without any math libraries.</p>
  
  <p>Does anyone know of or have a piece of code that can fit an ellipsoid to data which I can plug straight into my project? In C would be best, but it should be no problem for me to convert from C++, Java, C#, python etc.</p>
  
  <p>EDIT: Just being able to find the centre would be a huge help too. Note that the points aren't evenly spaced so taking the mean won't result in the centre.</p>