Poftethef9t

Answered

2022-06-27

Let's say we define the orientation of the ellipsoid from its major axis (the largest axis of the ellipsoid). Assuming the 3 axes of the ellipsoid to be on the three coordinates with lengths of $a$, $b$ and $c$ along each axis (with $a\ge b$ and $a\ge c$), then only a single affine transformation (to a sphere) is necessary:

$\left[\begin{array}{cccc}a& 0& 0& 0\\ 0& b& 0& 0\\ 0& 0& c& 0\\ 0& 0& 0& 1\end{array}\right]$

Now, if we first rotate the major axis by $\theta $ from the first axis towards the second axis, and then rotate it by $\varphi $ from the (rotated) first axis towards the third axis, the combined affine transformation becomes:

$\left[\begin{array}{cccc}a& 0& 0& 0\\ 0& b& 0& 0\\ 0& 0& c& 0\\ 0& 0& 0& 1\end{array}\right]\left[\begin{array}{cccc}cos\theta & -sin\theta & 0& 0\\ sin\theta & cos\theta & 0& 0\\ 0& 0& 1& 0\\ 0& 0& 0& 1\end{array}\right]\left[\begin{array}{cccc}cos\varphi & 0& -sin\varphi & 0\\ 0& 1& 0& 0\\ sin\varphi & 0& cos\varphi & 0\\ 0& 0& 0& 1\end{array}\right]$

Is the multiplied matrix (from left to right) the correct affine transformation that must go into the equations in the links above?

$\left[\begin{array}{cccc}a& 0& 0& 0\\ 0& b& 0& 0\\ 0& 0& c& 0\\ 0& 0& 0& 1\end{array}\right]$

Now, if we first rotate the major axis by $\theta $ from the first axis towards the second axis, and then rotate it by $\varphi $ from the (rotated) first axis towards the third axis, the combined affine transformation becomes:

$\left[\begin{array}{cccc}a& 0& 0& 0\\ 0& b& 0& 0\\ 0& 0& c& 0\\ 0& 0& 0& 1\end{array}\right]\left[\begin{array}{cccc}cos\theta & -sin\theta & 0& 0\\ sin\theta & cos\theta & 0& 0\\ 0& 0& 1& 0\\ 0& 0& 0& 1\end{array}\right]\left[\begin{array}{cccc}cos\varphi & 0& -sin\varphi & 0\\ 0& 1& 0& 0\\ sin\varphi & 0& cos\varphi & 0\\ 0& 0& 0& 1\end{array}\right]$

Is the multiplied matrix (from left to right) the correct affine transformation that must go into the equations in the links above?

Answer & Explanation

Christina Ward

Expert

2022-06-28Added 19 answers

Let's say you have an ellipsoid centered at $\overrightarrow{c}$ with semi-principal axes ${\overrightarrow{r}}_{1}$, ${\overrightarrow{r}}_{2}$, and ${\overrightarrow{r}}_{3}$:

${\overrightarrow{r}}_{1}=\left[\begin{array}{c}{r}_{11}\\ {r}_{21}\\ {r}_{31}\end{array}\right],\phantom{\rule{2em}{0ex}}{\overrightarrow{r}}_{2}=\left[\begin{array}{c}{r}_{12}\\ {r}_{22}\\ {r}_{32}\end{array}\right],\phantom{\rule{2em}{0ex}}{\overrightarrow{r}}_{3}=\left[\begin{array}{c}{r}_{13}\\ {r}_{23}\\ {r}_{33}\end{array}\right]$

The surface of the ellipsoid passes through points $\overrightarrow{c}\pm {\overrightarrow{r}}_{1}$, $\overrightarrow{c}\pm {\overrightarrow{r}}_{2}$ and $\overrightarrow{c}\pm {\overrightarrow{r}}_{3}$.

The semi-principal axes are all perpendicular: ${\overrightarrow{r}}_{1}\cdot {\overrightarrow{r}}_{2}=0$, ${\overrightarrow{r}}_{1}\cdot {\overrightarrow{r}}_{3}=0$, and ${\overrightarrow{r}}_{2}\cdot {\overrightarrow{r}}_{3}=0$.

The axis-aligned bounding box for the above ellipsoid is defined by

$\begin{array}{c}x={c}_{x}\pm \sqrt{{r}_{11}^{2}+{r}_{12}^{2}+{r}_{13}^{2}}\\ y={c}_{y}\pm \sqrt{{r}_{21}^{2}+{r}_{22}^{2}+{r}_{23}^{2}}\\ z={c}_{z}\pm \sqrt{{r}_{31}^{2}+{r}_{32}^{2}+{r}_{33}^{2}}\end{array}$

Note that this applies also to the case where the homogenous transformation matrix M that transforms the unit sphere to the ellipsoid is

$\mathbf{M}=\left[\begin{array}{cccc}{r}_{11}& {r}_{12}& {r}_{13}& {c}_{x}\\ {r}_{21}& {r}_{22}& {r}_{23}& {c}_{y}\\ {r}_{31}& {r}_{32}& {r}_{33}& {c}_{z}\\ 0& 0& 0& 1\end{array}\right]$

${\overrightarrow{r}}_{1}=\left[\begin{array}{c}{r}_{11}\\ {r}_{21}\\ {r}_{31}\end{array}\right],\phantom{\rule{2em}{0ex}}{\overrightarrow{r}}_{2}=\left[\begin{array}{c}{r}_{12}\\ {r}_{22}\\ {r}_{32}\end{array}\right],\phantom{\rule{2em}{0ex}}{\overrightarrow{r}}_{3}=\left[\begin{array}{c}{r}_{13}\\ {r}_{23}\\ {r}_{33}\end{array}\right]$

The surface of the ellipsoid passes through points $\overrightarrow{c}\pm {\overrightarrow{r}}_{1}$, $\overrightarrow{c}\pm {\overrightarrow{r}}_{2}$ and $\overrightarrow{c}\pm {\overrightarrow{r}}_{3}$.

The semi-principal axes are all perpendicular: ${\overrightarrow{r}}_{1}\cdot {\overrightarrow{r}}_{2}=0$, ${\overrightarrow{r}}_{1}\cdot {\overrightarrow{r}}_{3}=0$, and ${\overrightarrow{r}}_{2}\cdot {\overrightarrow{r}}_{3}=0$.

The axis-aligned bounding box for the above ellipsoid is defined by

$\begin{array}{c}x={c}_{x}\pm \sqrt{{r}_{11}^{2}+{r}_{12}^{2}+{r}_{13}^{2}}\\ y={c}_{y}\pm \sqrt{{r}_{21}^{2}+{r}_{22}^{2}+{r}_{23}^{2}}\\ z={c}_{z}\pm \sqrt{{r}_{31}^{2}+{r}_{32}^{2}+{r}_{33}^{2}}\end{array}$

Note that this applies also to the case where the homogenous transformation matrix M that transforms the unit sphere to the ellipsoid is

$\mathbf{M}=\left[\begin{array}{cccc}{r}_{11}& {r}_{12}& {r}_{13}& {c}_{x}\\ {r}_{21}& {r}_{22}& {r}_{23}& {c}_{y}\\ {r}_{31}& {r}_{32}& {r}_{33}& {c}_{z}\\ 0& 0& 0& 1\end{array}\right]$

Brenden Tran

Expert

2022-06-29Added 9 answers

Here is full soluion:

We can describe the transformation of the unit sphere to the above ellipsoid using

$\begin{array}{}\text{(1)}& \overrightarrow{p}(u,v,w)=\overrightarrow{p}(\overrightarrow{t})=\overrightarrow{c}+u{\overrightarrow{r}}_{1}+v{\overrightarrow{r}}_{2}+w{\overrightarrow{r}}_{3}=\overrightarrow{c}+\mathbf{R}\overrightarrow{t}\end{array}$

where $\overrightarrow{t}=(u,v,w)$ fulfills

$\Vert \overrightarrow{t}\Vert =1\phantom{\rule{2em}{0ex}}\phantom{\rule{thickmathspace}{0ex}}\u27fa\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{2em}{0ex}}{u}^{2}+{v}^{2}+{w}^{2}=1$

on the surface of the ellipsoid, and

$\Vert \overrightarrow{t}\Vert <1\phantom{\rule{2em}{0ex}}\phantom{\rule{thickmathspace}{0ex}}\u27fa\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{2em}{0ex}}{u}^{2}+{v}^{2}+{w}^{2}<1$

within the ellipsoid, and matrix R has the semi-principal axes as column vectors,

$\mathbf{R}=\left[\begin{array}{ccc}{\overrightarrow{r}}_{1}& {\overrightarrow{r}}_{2}& {\overrightarrow{r}}_{3}\end{array}\right]=\left[\begin{array}{ccc}{r}_{11}& {r}_{12}& {r}_{13}\\ {r}_{21}& {r}_{22}& {r}_{23}\\ {r}_{31}& {r}_{32}& {r}_{33}\end{array}\right]$

Essentially, we scale the unit sphere by the semi-principal axes, rotate it to the new orientation, and translate the center.

The above operation is invertible, if the ellipsoid is not degenerate; that is, if $\Vert {\overrightarrow{r}}_{1}\Vert >0$, $\Vert {\overrightarrow{r}}_{2}\Vert >0$, and $\Vert {\overrightarrow{r}}_{3}\Vert >0$.

Since rotation matrices are orthonormal, its inverse is its transpose. To counteract the scaling, we scale by the inverses of the semi-principal axes.

The scaling vectors are now row vectors of the transformation matrix, with lengths inverse to the corresponding semi-principal axis length; i.e.

${\overrightarrow{s}}_{n}={\left(\frac{{\overrightarrow{r}}_{n}}{{\Vert {\overrightarrow{r}}_{n}\Vert}^{2}}\right)}^{T},\phantom{\rule{2em}{0ex}}n=1,2,3$

so that

$\Vert {\overrightarrow{s}}_{n}\Vert ={\Vert {\overrightarrow{r}}_{n}\Vert}^{-1},\phantom{\rule{2em}{0ex}}n=1,2,3$

i.e.

${\overrightarrow{s}}_{1}=\frac{{\overrightarrow{r}}_{1}}{{\Vert {\overrightarrow{r}}_{1}\Vert}^{2}}=\left[\begin{array}{ccc}{s}_{11}& {s}_{12}& {s}_{13}\end{array}\right]$

${\overrightarrow{s}}_{2}=\frac{{\overrightarrow{r}}_{2}}{{\Vert {\overrightarrow{r}}_{2}\Vert}^{2}}=\left[\begin{array}{ccc}{s}_{21}& {s}_{22}& {s}_{23}\end{array}\right]$

${\overrightarrow{s}}_{3}=\frac{{\overrightarrow{r}}_{3}}{{\Vert {\overrightarrow{r}}_{3}\Vert}^{2}}=\left[\begin{array}{ccc}{s}_{31}& {s}_{32}& {s}_{33}\end{array}\right]$

${s}_{ij}=\frac{{r}_{ji}}{{r}_{1i}^{2}+{r}_{2i}^{2}+{r}_{3i}^{2}},\phantom{\rule{2em}{0ex}}i=1,2,3;\phantom{\rule{thickmathspace}{0ex}}j=1,2,3$

$\mathbf{S}=\left[\begin{array}{ccc}{s}_{11}& {s}_{12}& {s}_{13}\\ {s}_{21}& {s}_{22}& {s}_{23}\\ {s}_{31}& {s}_{32}& {s}_{33}\end{array}\right]$

Now,

$\begin{array}{}\text{(2)}& \overrightarrow{t}(\overrightarrow{p})={\overrightarrow{s}}_{1}\cdot (\overrightarrow{p}-\overrightarrow{c})+{\overrightarrow{s}}_{2}\cdot (\overrightarrow{p}-\overrightarrow{c})+{\overrightarrow{s}}_{3}\cdot (\overrightarrow{p}-\overrightarrow{c})=\mathbf{S}(\overrightarrow{p}-\overrightarrow{c})\end{array}$

Essentially, (1) and (2) are the inverse of each other.

If you insist on using Euler or Tait-Bryan angles or other similar angular convention, I recommend you use them to calculate the semi-principal axes ${\overrightarrow{r}}_{1}$, ${\overrightarrow{r}}_{2}$, and ${\overrightarrow{r}}_{3}$ only, and then apply the above vector solution.

We can describe the transformation of the unit sphere to the above ellipsoid using

$\begin{array}{}\text{(1)}& \overrightarrow{p}(u,v,w)=\overrightarrow{p}(\overrightarrow{t})=\overrightarrow{c}+u{\overrightarrow{r}}_{1}+v{\overrightarrow{r}}_{2}+w{\overrightarrow{r}}_{3}=\overrightarrow{c}+\mathbf{R}\overrightarrow{t}\end{array}$

where $\overrightarrow{t}=(u,v,w)$ fulfills

$\Vert \overrightarrow{t}\Vert =1\phantom{\rule{2em}{0ex}}\phantom{\rule{thickmathspace}{0ex}}\u27fa\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{2em}{0ex}}{u}^{2}+{v}^{2}+{w}^{2}=1$

on the surface of the ellipsoid, and

$\Vert \overrightarrow{t}\Vert <1\phantom{\rule{2em}{0ex}}\phantom{\rule{thickmathspace}{0ex}}\u27fa\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{2em}{0ex}}{u}^{2}+{v}^{2}+{w}^{2}<1$

within the ellipsoid, and matrix R has the semi-principal axes as column vectors,

$\mathbf{R}=\left[\begin{array}{ccc}{\overrightarrow{r}}_{1}& {\overrightarrow{r}}_{2}& {\overrightarrow{r}}_{3}\end{array}\right]=\left[\begin{array}{ccc}{r}_{11}& {r}_{12}& {r}_{13}\\ {r}_{21}& {r}_{22}& {r}_{23}\\ {r}_{31}& {r}_{32}& {r}_{33}\end{array}\right]$

Essentially, we scale the unit sphere by the semi-principal axes, rotate it to the new orientation, and translate the center.

The above operation is invertible, if the ellipsoid is not degenerate; that is, if $\Vert {\overrightarrow{r}}_{1}\Vert >0$, $\Vert {\overrightarrow{r}}_{2}\Vert >0$, and $\Vert {\overrightarrow{r}}_{3}\Vert >0$.

Since rotation matrices are orthonormal, its inverse is its transpose. To counteract the scaling, we scale by the inverses of the semi-principal axes.

The scaling vectors are now row vectors of the transformation matrix, with lengths inverse to the corresponding semi-principal axis length; i.e.

${\overrightarrow{s}}_{n}={\left(\frac{{\overrightarrow{r}}_{n}}{{\Vert {\overrightarrow{r}}_{n}\Vert}^{2}}\right)}^{T},\phantom{\rule{2em}{0ex}}n=1,2,3$

so that

$\Vert {\overrightarrow{s}}_{n}\Vert ={\Vert {\overrightarrow{r}}_{n}\Vert}^{-1},\phantom{\rule{2em}{0ex}}n=1,2,3$

i.e.

${\overrightarrow{s}}_{1}=\frac{{\overrightarrow{r}}_{1}}{{\Vert {\overrightarrow{r}}_{1}\Vert}^{2}}=\left[\begin{array}{ccc}{s}_{11}& {s}_{12}& {s}_{13}\end{array}\right]$

${\overrightarrow{s}}_{2}=\frac{{\overrightarrow{r}}_{2}}{{\Vert {\overrightarrow{r}}_{2}\Vert}^{2}}=\left[\begin{array}{ccc}{s}_{21}& {s}_{22}& {s}_{23}\end{array}\right]$

${\overrightarrow{s}}_{3}=\frac{{\overrightarrow{r}}_{3}}{{\Vert {\overrightarrow{r}}_{3}\Vert}^{2}}=\left[\begin{array}{ccc}{s}_{31}& {s}_{32}& {s}_{33}\end{array}\right]$

${s}_{ij}=\frac{{r}_{ji}}{{r}_{1i}^{2}+{r}_{2i}^{2}+{r}_{3i}^{2}},\phantom{\rule{2em}{0ex}}i=1,2,3;\phantom{\rule{thickmathspace}{0ex}}j=1,2,3$

$\mathbf{S}=\left[\begin{array}{ccc}{s}_{11}& {s}_{12}& {s}_{13}\\ {s}_{21}& {s}_{22}& {s}_{23}\\ {s}_{31}& {s}_{32}& {s}_{33}\end{array}\right]$

Now,

$\begin{array}{}\text{(2)}& \overrightarrow{t}(\overrightarrow{p})={\overrightarrow{s}}_{1}\cdot (\overrightarrow{p}-\overrightarrow{c})+{\overrightarrow{s}}_{2}\cdot (\overrightarrow{p}-\overrightarrow{c})+{\overrightarrow{s}}_{3}\cdot (\overrightarrow{p}-\overrightarrow{c})=\mathbf{S}(\overrightarrow{p}-\overrightarrow{c})\end{array}$

Essentially, (1) and (2) are the inverse of each other.

If you insist on using Euler or Tait-Bryan angles or other similar angular convention, I recommend you use them to calculate the semi-principal axes ${\overrightarrow{r}}_{1}$, ${\overrightarrow{r}}_{2}$, and ${\overrightarrow{r}}_{3}$ only, and then apply the above vector solution.

Most Popular Questions