The Problem:
I am trying to map a point on an ellipsoid to its corresponding point on a sphere of arbitrary size centered at the origin. I would like to be able to shift any point with the following formula:
$$ p_{sphere} = \mathbf A (p_{ellipsoid} - c) $$
I am trying to determine the A matrix that will transform a point from a fully defined ellipsoid E matrix.
Where an ellipsoid (or other quadric surface) can be defined with the following:
$$ \left[ \begin{matrix} x & y & z & 1\\ \end{matrix} \right] \mathbf E \left[ \begin{matrix} x\\ y\\ z\\ 1\\ \end{matrix} \right] = 0 $$
$$ Where\ \mathbf E = \begin{pmatrix} a & h & g & p\\ h & b & f & q\\ g & f & c & r\\ p & q & r & d \end{pmatrix} = \left[ \begin{array}{c|c} \mathbf M_{3x3} & \vec{\mathbf n}\\ \hline \vec{\mathbf n}^T & d\\ \end{array} \right] $$
My Progress:
From the understanding I have developed so far, I have been able to determine the offset to the origin with the following which I understand:
$$ \left[ \begin{matrix} x_0 \\ y_0 \\ z_0 \\ \end{matrix} \right] = -\mathbf M^{-1}\vec{\mathbf n} $$
Finding the eigenvectors and eigenvalues of the M matrix can describe the rotation and scale of the ellipsoid. With these values, I can apply them to the M matrix to rotate and scale the "frame" of the ellipsoid to align with the X, Y, and Z axes.
Figure 1: Scaled and rotated principal axes
Figure 2: A specific ellipsoid plotted with its principal axes
The Question:
At this point, I feel I should have enough information to be able to modify the E matrix to plot a sphere, and furthermore develop an A matrix that fulfills the requirement above. However, at this point I am unsure how to go about doing exactly that. I would very much appreciate some guidance on approaching this problem.
Some Extra Context:
- In some other discussions I have had, the following equation can be used to find the A matrix:
$$ \mathbf A = \frac{F}{\sqrt{\vec{\mathbf n}^T \mathbf M^{-1} \vec{\mathbf n} - d}} \mathbf M^{1/2} $$
Where F is the radius of the sphere and the M^(1/2) on the end is the matrix square root.
I have tested this equation, and it works in transferring an ellipsoidal point cloud onto a sphere, but I do not understand how or why this equation functions. I assume I should arrive at the same result, but like I mentioned, I'm not quite sure how to approach the next part of this problem. I would very much like to understand the underlying fundamentals of what's going on instead of just using this equation.
Figure 3: An example of using this equation to transform an ellipsoid into a sphere.
Additionally, I feel like this question is fundamentally asking the second part of my question, but I think my linear algebra understanding is a little too weak to take this and run.
Lastly, I'm an engineer, and it has been years since I've done any hardcore math, so I apologize in advance if I'm a bit dense on terminology. Thank you for your time.
Question: "I am trying to map a point on an ellipsoid to its corresponding point on a sphere of arbitrary size centered at the origin."
Answer: If $F:=(u/a)^2+(v/b)^2+(w/c)^2-1$ and $f:=x^2+y^2+z^2-d^2$ it follows $E:=V(F) \subseteq X:=\mathbb{R}^3$ and $S:=V(f) \subseteq X$ is an ellipsoid of type $(a,b,c)$ and a surface with arbitrary radius $d$. The elements $u,v,w,x,y,z$ are independent variables. Here $a,b,c,d >0$ are real numbers. By $V(F)$ I mean the set of triples $(u,v,w)\in k^3:=\mathbb{R}^3$ such that
$$F(u,v,w)=(u/a)^2+(v/b)^2+(w/c)^2-1=0.$$
$V(F)$ is the "zero set" of the polynomial $F$. There is an "isomorphism" (a 1-1 map of sets that is polynomial with a polynomial inverse map)
$$\phi: E \rightarrow S$$
defined by
$$\phi(u,v,w):=(du/a, dv/b, dw/c)$$
with inverse $\psi: S \rightarrow E$
defined by
$$\psi(x,y,z):=(ax/d, by/d, cz/d).$$
If $p:=(u,v,w)\in V(F)$ it follows
$$(u/a)^2+(v/b)^2+(w/c)^2=1.$$
By definition
$$F(p):=(du/a, dv/b, dw/c)$$
and
$$(du/a)^2+(dv/b)^2+(dw/c)^2= ((u/a)^2+(v/b)^2+(w/c)^2)d^2=d^2.$$
Hence $F(p)\in V(f)$ and the map is well defined. You may check that $\phi \circ \psi= \psi \circ \phi = identity$, hence the two maps $\phi, \psi$ give isomorphisms $E \cong S$. The sets (=algebraic varieties) $E,S \subseteq k^3$ are not the same subsets of $k^3$ but the maps $\phi, \psi$ defined above give polynomial maps between $E,S$ that induce 1-1 correspondences of sets, and for this reason we say that the map $\phi:E \cong S$ is an "isomorphism of algebraic varieties".
Quesiton: "I am trying to map a point on an ellipsoid to its corresponding point on a sphere of arbitrary size"
Answer: Take any point $p \in E$ and map it to $\phi(p) \in S$.
Question: "However, I do not understand well enough to be able to implement this into a general method to understand how to change the E matrix or the A = [...] equation I referenced. Do you have some references I can read to help develop a methodology for this? Thanks again."
Answer: You must "diagonalize" your quadratic polynomial. If
$$Q(x,y,z):=a_1x^2+a_2xy + a_3xz + a_4y^2+a_5 yz+ a_6 z^2 +a_7x+ a_8 y + a_9 z+ a_{10}$$
with $a_i \in k$ you may diagonalize $Q$ making a base change from $x,y,z$ to $u,v,w$. In the new basis your polynomial will be
$$ Q'(u,v,w)=b_1u^2+b_2v^2+b_3w^2 + b_4$$
with $b_i \in k$. If $b_1,b_2,b_3 >0$ and $b_4<0$ you get an ellipsoid.
The base change removes the $xy,xz,yz,x,y,z$ terms in $Q$.
Look for "diagonalization of quadratic forms".
https://en.wikipedia.org/wiki/Quadratic_form