# 3D rotation of an ellipse

Let’s say we want to represent an ellipse in the three-dimensional space. If it’s centered at the origin and in the $$(x, y)$$ plane, then its equation is obviously

$$\frac{x^2}{a^2}+\frac{y^2}{b^2}+z=1$$

where $$z$$ would be zero if it’s on the $$(x, y)$$ plane and any real number if it’s parallel to the $$(x, y)$$ plane.

Now, let’s rotate and move our ellipse on the $$(x, y)$$ plane or parallel to it, by $$(X, Y)$$ and angle $$\theta$$. (This is equivalent to a rotation around the $$z$$ axis.) We thus have:

$$\frac{(x - x _{0}) \cos \theta + (y - y_0) \sin \theta}{a^2} + \frac{(x - x _0) \sin \theta + (y - y_0) \cos \theta}{b^2} + z = 1$$

But what if our ellipse is also rotated around the $$x$$ axis or around the $$y$$ axis? Or even around both of these axes. Let’s call these angles $$\phi$$ (rotation around the $$x$$ axis) and $$\xi$$ (rotation around the $$y$$ axis).

What would we get? My math skills fail me at that point, so I would appreciate any help possible.

• Are you talking about solid of revolution?, if not then an ellipse would stay an ellipse when you cut through a plane and it'll be an ellipsoid in 3D Aug 16, 2020 at 21:41
• The term $z$ in the equation is weird. If it's $z^2$ or $\frac{z^2}{c^2}$ I understand that it defines an ellipsoid. Not sure what's that when that's a $z$. Aug 16, 2020 at 21:44
• @ArcticChar Yes right, It looks like a parabolic-ellipsoid Aug 16, 2020 at 21:48
• No; I am not looking for the formula of an ellipsoid. I’m looking for the formula of an ellipse. I know it will stay an ellipse when rotated around any axis, but what would its formula be? And in this case, z is just the distance of the ellipse from the (x, y) plane. Aug 17, 2020 at 0:37
• Are you trying to describe an ellipse sitting inside the $x-y$ plane? Aug 17, 2020 at 4:15

An ellipse in 3D space cannot be described with a single cartesian equation: your equation is in fact that of a surface (an elliptic paraboloid).

To describe a curve in space it's better to use a parametric representation. In your case, for instance, you can start from the polar equation of an ellipse, with its center at a focus:

$$r(\theta)={a(1-e^2)\over1+e\cos\theta}.$$ Then you should find from your data a unit vector $$\hat {\mathbf x}$$ directed from a focus (primary star) to the periastron, a unit vector $$\hat {\mathbf n}$$ perpendicular to the plane of the ellipse, and a unit vector $$\hat {\mathbf y}=\hat {\mathbf n}\times\hat {\mathbf x}$$ perpendicular to the other two. You can then write a parametric equation for the ellipse: $$\vec {\mathbf r}=r(\theta)\cos\theta\ \hat {\mathbf x}+ r(\theta)\sin\theta\ \hat {\mathbf y}.$$

EDIT.

If one really wants a cartesian equation, then an ellipse can be described by two equations. For instance, the ellipse in the $$xy$$ plane whose 2D equation is $$\tag{1} {x^2\over a^2}+{y^2\over b^2}=1$$ is described in 3D by that same equation (which in space is the equation of an elliptic cylinder) and by the equation of the plane onto which the ellipse lies, that is: $$\tag{2} z=0.$$

We want now to find the equation of the same ellipse after these rotations are applied:

• first, a rotation by an angle $$\theta$$ about $$z$$ axis;

• then a rotation by an angle $$\phi$$ about $$x$$ axis;

• finally a rotation by an angle $$\xi$$ about $$y$$ axis.

(Note that changing the order of the rotations will change the result: I'm sticking to the order the OP confirmed in a comment below).

To find the equation after these rotations, we just need to replace $$\pmatrix{x\\ y\\ z}$$ in the equations with $$R_z(-\theta)R_x(-\phi)R_y(-\xi)\pmatrix{x\\ y\\ z},$$ where $$R_z(\theta)$$ is the rotation matrix about $$z$$ axis by angle $$\theta$$, and so on.

I used Mathematica to make these tedious computations. Here is the transformed of equation $$(1)$$ after these rotations: $$\tag{1'} \frac{1}{4} \sin ^2\theta \left(\left(2 a^2-b^2\right) (\cos2\xi (x-z) (x+z) -2 x z \sin2\xi)+2 a^2 \left(x^2+z^2\right)+b^2\left(x^2+2 y^2+z^2\right) +2 b^2 \cos2\phi (-x \sin\xi +y-z \cos\xi) (x \sin\xi +y+z \cos\xi) +4 b^2 y \sin 2 \phi (x \sin\xi +z \cos\xi )\right) \\ +\cos ^2\theta \left(\cos ^2\xi\left(a^2 z^2 \sin ^2\phi+b^2 x^2\right) +z \cos\xi \left(a^2 y\sin2\phi-2 x\sin\xi\left(b^2-a^2 \sin ^2\phi\right)\right) \\ +a^2 (x \sin\xi \sin\phi +y \cos\phi )^2+b^2 z^2 \sin ^2\xi\right) \\ -(a^2-b^2)\sin2\theta (x \cos\xi -z\sin\xi ) (\sin \phi (x \sin \xi +z \cos\xi )+y \cos\phi)=a^2 b^2;$$ and the transformed of equation $$(2)$$: $$\tag{2'} x \sin\xi \cos\phi -y \sin\phi +z \cos\xi\cos\phi = 0.$$ The rotated ellipse is then described by eqs. $$(1')$$ and $$(2')$$.

Finally, to have an ellipse centred at $$(x_0,y_0,z_0)$$, substitute everywere in the above formulas $$x$$ with $$x-x_0$$, $$y$$ with $$y-y_0$$ and $$z$$ with $$z-z_0$$.

• Thanks for this, but vectors are very difficult for me to understand. :( Also, this doesn’t give me the relationship of this ellipse with respect to, say, the Earth. I can’t believe there’s no way to describe a curve in 3D space… If I had a straight line, it would be something like 𝑎1𝑥+𝑏1𝑦+𝑐1𝑧=𝑟1 and 𝑎2𝑥+𝑏2𝑦+𝑐2𝑧=𝑟2, so why can’t we do the same thing for a curve? I don’t mind having two or three equations, if not more, but vectors are all gibberish to me… :( Aug 18, 2020 at 15:01
• @PierrePaquette In that case you should explain more clearly which data you known. Do you have, for instance, the 3D coordinates of the ellipse centre (or a focus) and of a vertex (periastron or apastron)? Aug 18, 2020 at 16:28
• I have nothing. I want a generic formula (or set of formulas) for a generic case, not just for orbits. But one way to see it would be to describe the Moon’s orbit around the Earth with respect to the Sun’s equator. So the origin of the coordinate system would be the Sun’s center, and as the Moon’s orbit is tilted with respect to the Earth’s orbit, which is itself tilted with respect to the Sun’s equator, the Moon’s orbit is not parallel to the Sun’s equator plane. Aug 19, 2020 at 19:11
• Formulas depend on input data, so if you want an answer you must specify by which parameters (positions, angles, ...) the ellipse is defined. Aug 19, 2020 at 19:54
• OK so, that would be: semimajor axis (a); semiminor axis (b) OR eccentricity (e), which allows calculating b; offset in {x, y, z} of the centre of the ellipse from the centre of the coordinate system; tilt {θ, φ, ξ} where φ is along an axis parallel to the x axis, ξ along an axis parallel to the y axis, and θ along an axis parallel to the z axis. (Compared to the Sun as in my example, the x axis would pass through the Carrington Meridian and the y axis through 90° East longitude, both on the Sun’s equator, and the z axis would pass through the Sun’s North pole.) Aug 20, 2020 at 5:27