Ellipsoid equation: Converting from implicit form to explicit matrix form

671 Views Asked by At

The implicit equation of a general ellipsoid can be written as follows:

$a_0x^2 + a_1y^2 + a_2z^2 +a_3xy + a_4yz + a_5xz + a_6x + a_7y + a_8z + 1 = 0$

I can also define the same ellipsoid with a 3x3 affine transformation $A$ and a translation $B$ on a unit sphere as:

$AX + B$

where $X$ is a vector of points on the unit sphere at origin, i.e. $X'X = 1$

Suppose I have the parameters of the implicit form ($a_0 ... a_8$), how can I obtain $A$ and $B$? I was able to solve a linear system to get $B$, it's the matrix $A$ that I'm unable to find.

1

There are 1 best solutions below

0
On

First, write the given implicit equation in compact matrix-vector notation, by introducing the vector $r = [x, y, z]$ , then the implicit equation can be re-written as

$ r^T A r + b^T r + c = 0 $

where

$A=\large \displaystyle \begin{bmatrix} a_0 && \frac{1}{2}a_3 && \frac{1}{2}a_5 \\ \frac{1}{2}a_3 && a_1 && \frac{1}{2}a_4 \\ \frac{1}{2}a_5 && \frac{1}{2}a_4 && a_2 \end{bmatrix} $

$B = \large \displaystyle \begin{bmatrix} a_6 \\ a_7 \\ a_8 \end{bmatrix}$

and

$ c = 1 $

Next, find the center of the ellipoid, it is given by

$r_0 = - \dfrac{1}{2} A^{-1} b $

Using $r_0 $ , re-write the ellipsoid equation as follows:

$ (r - r_0)^T A (r - r_0) + c - r_0^T A r_0 = 0 $

Divide through by $(r_0^T A r_0 - c)$ to obtain

$ (r - r_0)^T A' (r - r_0) - 1 = 0$

where $A' = A / (r_0^T A r_0 - c) $

Next, diagonalize the matrix $A'$ so that $A' = R D R^T $ where $R $ is a $3 \times 3 $ rotation matrix and $D$ is a positive definite diagonal matrix (i.e. all the diagonal elements are positive, otherwise it would not be an ellipsoid).

Hence, the equation has been re-written as,

$ (r - r_0)^T R D R^T (r - r0) = 1 $

Split $D$ into $D = D^{\frac{1}{2}} D^{\frac{1}{2}}$ , and define,

$ p = D^{\frac{1}{2} } R^T (r - r_0) $

it follows that

$p^T p = 1 $

Thus, the vector $p$ lies on the unit sphere, and,

$ r = r_0 + R D^{-\frac{1}{2}} p $

So the affine transformation of point on the unit sphere to the ellipsoid is given by

$T(p) = A_0 p + b_0 $

where $A_0 = R D^{-\frac{1}{2}} $ and $b_0 = r_0$