Distance from an arbitrary point to an ellipsoid

66 Views Asked by At

I have a collection of points in $\mathbb{R}^3$ which I would like to fit an ellipsoid to. My approach is to frame it as an optimization problem, where for $$\frac{(x-x_0)^2}{a} + \frac{(y-y_0)^2}{b} + \frac{(z-z_0)^2}{c} = 1 $$ I determine $a, b, c, x_0, y_0$ and $z_0$ such that the sum of the (squared) distance between my points and the ellipsoid is minimized. Here I have no previous knowledge regarding the center of the ellipse.

This all seems relatively simply to code up aside from determining the distance between each point to the ellipsoid. Does an analytic solution exist for this problem? If not, is there any other "nice" way of doing this?