Finding normal of arbitrarily oriented ellipsoid For an axis-aligned ellipsoid, the equation is
$$ \frac{x^2}{a^2} + \frac{y^2}{b^2} + \frac{z^2}{c^2} = 1. $$
With $a=b$ this will give a spheroid with the $z$ axis as its symmetry axis. A spheroid which is centered at the origin but arbitrarily oriented can be described by its dimensions $a=b$ and $c$ and a vector $\vec r$ defining its orientation. So that vector $\vec r$ in the general case would correspond to the $z$-axis in the axis-aligned equation above.
I need to compute the normal of such a spheroid at any point on its surface. This can be done by computing the gradients of the equation. For an arbitrarily oriented spheroid, how to find the surface normals?
I have the following idea:


*

*Compute rotation matrix for transforming from $\vec r$ to $[0\;0\;1]$ using this.

*Compute the normals with the Cartesian aligned ellipsoid.

*Rotate the normal vector using $\vec r$.


Is there a better way to do this? For example, computing the normal directly on an arbitrarily oriented ellipsoid?

General approach of computing a gradient
Your axis-aligned ellipsoid can be rewritten as
$$ f(x,y,z) := b^2c^2x^2 + a^2c^2y^2 + a^2b^2z^2 = a^2b^2c^2 $$
Now the gradient of that left hand side consists of the partial derivatives.
$$ \vec\nabla f = \begin{pmatrix}
  2b^2c^2x \\
  2a^2c^2y \\
  2a^2b^2z
\end{pmatrix} $$
Sinde for the normal direction the magniture is irrelevant, you might drop that factor $2$ in each of these terms.
For a different orientation, make sure to write the ellipsoid as a polynomial in $x,y,z$. Then you can apply the same technique of computing partial differentials.
Finding the formula for rotated spheroid
If you take the spheroid $\frac{x^2+y^2}{a^2}+\frac{z^2}{c^2}=1$ and rotate it so that the original $z$ axis aligns with a vector $r=(s,t,u)$, what equation do you get? The OP actually asked this very question, and in my answer there I came up with the following equation for the spheroid:
\begin{multline*}
c^2\bigl((tz-uy)^2+(ux-sz)^2+(sy-tx)^2\bigr) + a^2(sx+ty+uz)^2 \\
 = a^2c^2(s^2+t^2+u^2)
\end{multline*}
Now expand that, collect terms with common monomials, and do the partial derivatives as above. I used a bit of computer algebra here.
$$\vec\nabla f = 2\begin{pmatrix}
a^2s^2+c^2(t^2+u^2)&(a^2-c^2)st&(a^2-c^2)su\\
(a^2-c^2)st&a^2t^2+c^2(s^2+u^2)&(a^2-c^2)tu\\
(a^2-c^2)su&(a^2-c^2)tu&a^2u^2+c^2(s^2+t^2)
\end{pmatrix}\cdot\begin{pmatrix}x\\y\\z\end{pmatrix}$$
