Let's say we define the orientation of the ellipsoid from its major axis (the largest...
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 , and along each axis (with and ), then only a single affine transformation (to a sphere) is necessary:
Now, if we first rotate the major axis by from the first axis towards the second axis, and then rotate it by from the (rotated) first axis towards the third axis, the combined affine transformation becomes:
Is the multiplied matrix (from left to right) the correct affine transformation that must go into the equations in the links above?
Answer & Explanation
Let's say you have an ellipsoid centered at with semi-principal axes , , and :
The surface of the ellipsoid passes through points , and .
The semi-principal axes are all perpendicular: , , and .
The axis-aligned bounding box for the above ellipsoid is defined by
Note that this applies also to the case where the homogenous transformation matrix M that transforms the unit sphere to the ellipsoid is
Here is full soluion:
We can describe the transformation of the unit sphere to the above ellipsoid using
on the surface of the ellipsoid, and
within the ellipsoid, and matrix R has the semi-principal axes as column vectors,
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 , , and .
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.
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 , , and only, and then apply the above vector solution.