Deriving the Implicit Equation of a Rotated Spheroid

InfernoSun
A spheroid is defined by:

x2/a2 + y2/b2 + z2/a2 - 1 = 0 (equation 1)

where a and b are the semi-major and semi-minor axes, respectively. If you have any two of x,y,z-values, you can solve for the third, simply by rearranging the above equation:

x = +/- sqrt(1 - y2/b2 - z2/a2)*a
y = +/- sqrt(1 - x2/a2 - z2/a2)*b
z = +/- sqrt(1 - x2/a2 - y2/b2)*a (equations 2 thru 4)

Once you accumulate a large number of (x,y,z) points covering the spheroid surface, you can rotate and translate them in cartesian space. Each point moves to a new position, defined generally by:

x'' = M1*x + M2*y + M3*z + M4
y'' = M5*x + M6*y + M7*z + M8
z'' = M9*x + M10*y + M11*z + M12 (equations 5 thru 7)

My question is, if I want to find the implicit equation of the spheroid after it has been rotated & translated, do I substitute equations 2-4 into equations 5-7, and then substitute 5-7 into equation 1 ? Or do I just substitute equations 5-7 into equation 1 ? Or am I totally lost and using the wrong approach?

Timbuqtu
The latter:

Let's regard some general rotated/translated spheroid living in an x,y,z-coordinate system. Now we know we can define a different coordinate system x'',y'',z'', by rotating/translating the x,y,z-axes, such that the spheroid is given by

x''2/a2 + y''2/b2 + z''2/a2 - 1 = 0 (equation 1)

Because we obtained the x'',y'',z'' coordinates by rotating/translating the x,y,z-axes, we can express our new coordinates as your equations 5 thru 7.

The spheroid still has to obey equation 1, so we can simply substitute equations 5 thru 7 into equation 1.

InfernoSun
I was afraid you would say that. 'Cause that's what I did. Unfortunately my implicit equation spheroid isn't behaving the same as my numerical spheroid (bunch of points or "mesh"). My mesh spheroid is doing exactly what it should do intuitively, which seems to verify that my rotation and translation operations are working perfectly.

My implicit spheroid is also displaying correctly, since I plugged the implicit equation into other software and got the same result. I can only conclude that the equation itself isn't correct. Somehow, my derivation has a typo, but I've checked and rechecked. I've even re-written it and gotten the same result. Bah!

InfernoSun
Here are the formula I've been using

Obviously I could have stopped with equations 5 thru 7, and worked with the mesh spheroid surface. The program worked perfectly up to this point. But I wanted a faster program, and that required an implicit formula for the spheroid. After I plugged equations 5 thru 7 into equation #1, I rearranged them into the general form of a quadric surface:

Ax2 + By2 + cz2 + Dxy + Exz + Fyz + Gx + Hy + Iz + J = 0 (equation 8)

where,

A = (M1^2) / (a^2) + (M5^2) / (b^2) + (M9^2) / (a^2)
B = (M2^2) / (a^2) + (M6^2) / (b^2) + (M10^2) / (a^2)
C = (M3^2) / (a^2) + (M7^2) / (b^2) + (M11^2) / (a^2)
D = 2 * M1 * M2 / (a^2) + 2 * M5 * M6 / (b^2) + 2 * M9 * M10 / (a^2)
E = 2 * M1 * M3 / (a^2) + 2 * M5 * M7 / (b^2) + 2 * M9 * M11 / (a^2)
F = 2 * M2 * M3 / (a^2) + 2 * M6 * M7 / (b^2) + 2 * M10 * M11 / (a^2)
G = 2 * M1 * M4 / (a^2) + 2 * M5 * M8 / (b^2) + 2 * M9 * M12 / (a^2)
H = 2 * M2 * M4 / (a^2) + 2 * M6 * M8 / (b^2) + 2 * M10 * M12 / (a^2)
I = 2 * M3 * M4 / (a^2) + 2 * M7 * M8 / (b^2) + 2 * M11 * M12 / (a^2)
J = (M4^2) / (a^2) + (M8^2) / (b^2) + (M12^2) / (a^2) - 1

(equations 9 thru 18)

So now the same rotation matrices that worked for the mesh surface give me an implicit formula that doesn't describe the exact same spheroid. It defines a spheroid, but not the same one. I'm trying to figure out why, or even how that could possibly have happened??

Here are some numbers as an example... The spheroid has semi-major and semi-minor axes defined as:

a = 6378137
b = 4000000

I assume the right-hand rule, with the y-axis coinciding with the minor axis of the spheroid. I performed the following operations:

1. rotated about the y-axis by 0 degrees
2. rotated about the x-axis by 20 degrees
3. rotated about the z-axis by 0 degrees
4. translated along the z-axis by 20870449.5777947 units
5. rotated about the x-axis by 0 degrees
6. rotated about the z-axis by 0 degrees

All angles were converted to radians before using trig functions. This yields the following constants for equations 5 thru 7. They were tested and checked out using the mesh spheroid. It displayed an intuitively correct image of a rotated spheroid on my screen.

M1 = 1
M2 = 0
M3 = 0
M4 = 0
M5 = 0
M6 = 0.939692620785908
M7 = 0.342020143325669
M8 = 0
M9 = 0
M10 = -0.342020143325669
M11 = 0.939692620785908
M12 = 20870449.5777947

Using the same constants in equations 9 thru 18 to determine the implicit spheroid equation yielded a very different spheroid.

A = 2.45817225764733E-14
B = 5.80644041447049E-14
C = 2.90173184317685E-14
D = 0
E = 0
F = 2.43733989084998E-14
G = 0
H = -3.50934283797512E-07
I = 9.64184020446144E-07
J = 9.70720017233234

If the geometric center of the unrotated spheroid was (0,0,0) and we used this point as a test of equations 5 thru 7, then by plugging the values for M1 thru M12 we get the following:

x'' = 1*x + 0*y + 0*z + 0
y'' = 0*x + 0.939692620785908*y + 0.342020143325669*z + 0
z'' = 0*x -0.342020143325669*y + 0.939692620785908*z + 20870449.5777947

Clearly, the geometric center of the spheroid would be moved along the z-axis to (0, 0, 20870449.5777947). A very intuitive result if the spheroid had been rotated first, then translated.

The same values for M1 thru M12 plugged into equations 9 thru 18 yielded the following implicit equation for the new spheroid surface (equation 8):

2.45817225764733E-14 *x^2 + 5.80644041447049E-14 *y^2 + 2.90173184317685E-14 *z^2 + 0*x*y + 0*x*z + 2.43733989084998E-14 *y*z + 0*x -3.50934283797512E-07 *y + 9.64184020446144E-07 *z + 9.70720017233234 = 0

Using DP Graph software, this spheroid appeared to be translated along the z-axis before being rotated about the x-axis, the opposite order of operations proven before with the mesh spheroid. The geometric center of this spheroid clearly did not remain on the z-axis. The implicit spheroid doesn't match the mesh spheroid.

What is going on here?

Last edited:
InfernoSun
Come on, there's got to be someone smarter than I am...