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:

  1. Compute rotation matrix for transforming from $\vec r$ to $[0\;0\;1]$ using this.
  2. Compute the normals with the Cartesian aligned ellipsoid.
  3. 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?

  • $\begingroup$ Just compute the gradient at a point of the ellipsoid: that always works. $\endgroup$ – Intelligenti pauca Jul 28 '16 at 16:02
  • $\begingroup$ Yes the gradient to the function on the left hand side will be orthogonal to the level sets of which the ellipsis "shell" or "surface" is one. $\endgroup$ – mathreadler Jul 28 '16 at 18:43

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}$$

  • $\begingroup$ I actually dont know how to write the ellipsoid equation for arbitrary orientation. If so, then it would be straight forward. Can you tell me how to? $\endgroup$ – SKPS Jul 28 '16 at 18:57
  • $\begingroup$ @SathishKrishnan: Well, it depends on the form you have for your ellipse. Give us that form and we can tell you how to convert it. $\endgroup$ – MvG Jul 28 '16 at 19:12
  • $\begingroup$ Actually a spheroid with $ \frac{x^2+y^2}{a^2} + \frac{z^2}{c^2} = 1 $ with $\vec r$ aligned to z-axis. For an arbitrary $\vec r$, how to write this equation? Can you update in your answer? $\endgroup$ – SKPS Jul 28 '16 at 19:48
  • $\begingroup$ @SathishKrishnan It took me a while to understand that you don't actually have a formula for the object you want. I guess this surprised me because you seem to have points which you assume will lie on its surface. I've updated my answer. And I guess I'll update your question to make this aspect clearer as well. Hope you don't mind. $\endgroup$ – MvG Jul 28 '16 at 20:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.