I'm trying to get the projection of an ellipsoid onto a sphere. Depicted in the image below, I need the projection of the red ellipsoid onto the unit sphere at the origin. I have tried various approaches that haven't worked like trying to project the ellipsoid onto various planes. The idea is that if you were an observer at the origin, what pixels in the sky would be obscured by the ellipsoid. A function defining those obscured pixels in spherical coordinates (the origin sphere frame of reference) would be ideal, but I can't seem to figure out how to get that equation... thanks!

sphere and ellipsoid


I think you could try something like the following.

Let an offset ellipsoid be:

E(u,v) = [a * cos(u) * sin(v); b * sin(u) * sin(v); c * cos(u)] + [x_off; y_off; z_off]

where u and v are like spherical coordinate angles. a, b, and c are ellipsoid deformation parameters. x_off, y_off, and z_off are the offsets defining the center of the ellipsoid.

Let the unit sphere at the origin be:

S(theta,phi) = [cos(theta) * sin(phi), sin(theta) * sin(phi), cos(phi)]

where theta and phi are spherical coordinate angles.

Then you want to solve something like:

E(u,v) = g(u,v) * S' => S' = E/g

where g(u,v) scales the vector E(u,v) (which gives each point on the ellipsoid E) back to a vector S' (a point on the surface of the sphere S). S' is the subset of points on the surface of the unit sphere S that are "occluded" by E. This means |E/g| = 1 for all (u,v).

So basically you have the surface of the ellipsoid E parameterized by (u,v), which gives a vector in 3-space as E(u,v), and the surface of the unit sphere S parameterized by (theta,phi), which gives a vector in 3-space as S(theta,phi). You then want to find the subset of points S' in S that can be scaled by a real number in order to produce a vector on the surface E. We have to use a different real number, in general, for each surface point E to it's map on S because the distance changes across the curved surfaces. Therefore, we use the real function g(u,v) over the parameterization of the ellipsoid E.

This might give some strange results if the ellipsoid is intersecting with the unit sphere, so the above simply assumes that |E| > |S| for all u and v. There is still the tricky part of solving for g(u,v), but this is the basic setup.

  • $\begingroup$ sounds like a good idea, but I have no idea how to get g(u,v). My multivariable calculus is not good. $\endgroup$ – pickle rick Mar 12 '15 at 21:42
  • $\begingroup$ Ok, so then you could just take the E vector and transform it into spherical coordinates and project it onto the unit sphere by setting the radial coordinate to one. The result is: S' = [1; arcos(Ez/sqrt(Ex^2 + Ey^2 + Ez^2)); arctan(Ey/Ex)] where E = [Ex; Ey; Ez] // although the arcos might be an arcsin depending on the spherical convention used. $\endgroup$ – ililil Mar 12 '15 at 22:54

If $p$ is a non-zero point, then $p/\|p\|$ is the point where the ray from the origin through $p$ hits the unit sphere.

Assuming you are using spherical coordinates in which $\theta$ denotes longitude (the angle from the half-plane $x > 0$, $y = 0$) and $\phi$ denotes co-latitude (the angle from the positive $z$-axis) a point $p/\|p\| = (x, y, z)$ can be converted into spherical coordinates using the formulas $$ \cos\theta = \frac{x}{\sqrt{1 - z^{2}}}, \qquad \sin\theta = \frac{y}{\sqrt{1 - z^{2}}}, \qquad \cos\phi = z. \tag{1} $$

If it's easier not to normalize first, i.e., you prefer to think of $p = (x, y, z)$ as an arbitrary point in space, the formulas $$ \cos\theta = \frac{x}{\sqrt{x^{2} + y^{2}}}, \qquad \sin\theta = \frac{y}{\sqrt{x^{2} + y^{2}}}, \qquad \cos\phi = \frac{z}{\sqrt{x^{2} + y^{2} + z^{2}}} \tag{2} $$ have the same effect.

If you're using this information to plot an ellipsoid on a visual field (say), it may be easiest to write parametric equations for the ellipsoid, call the component functions of the parametrization $(x, y, z)$, plug them into (2), and plot the resulting parametric region in the $(\theta, \phi)$ plane.

In any case, if the $z$-axis passes through your ellipsoid, the longitude $\theta$ will be discontinuous somewhere.

  • $\begingroup$ thanks for the answer, parametric equations would certainly be best in my case. I can't shoot an arbitrary number of rays from the origin to find which pixels are obscured. The equation I am imagining that I need is the one that describes all of the tangent points that you would obtain by shooting rays from the origin to the ellipsoid. Does that make sense? I think this would be an equation of an ellipse in spherical coordinates. $\endgroup$ – pickle rick Mar 12 '15 at 21:18

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.