Kepler's First Law in 3D Kepler's First Law in 2D polar is
$$
r = \frac{p}{1 + \varepsilon\cos(\nu)}.
$$ 
How can this be written to consider ellipses in 3D?  
I am trying to plot two ellipses in Python that are in different planes so I can use the 2D polar form to plot one ellipse, but I don't know how to adjust the equation to consider an angle change in the z direction.
 A: In 3D, an ellipse still lies in some plane, just this plane may not be $xy$-plane anymore, if you parametrize the ellipse using the polar coordinates on that specific plane, then the equation you obtain will still be $r = \dfrac{p}{1 + \varepsilon\cos\theta}$. 
Now $r$ is the standard Euclidean distance to the center $\mathbf{p}_0 = (x_0,y_0,z_0)$ of this ellipse, $\theta$ is the polar angle between the position vector $\mathbf{p}-\mathbf{p}_0 = \langle x-x_0,y-y_0,z-z_0\rangle$ and the major axis vector $\mathbf{a}$ with length $a$. Let the normal to the plane be $\mathbf{n}=\langle n_1,n_2,n_3\rangle$, then the minor axis vector can be computed as $\mathbf{b} = \dfrac{\mathbf{n}\times \mathbf{a}}{|\mathbf{n}\times \mathbf{a}|}b$. And the equation should be:
$$
|\mathbf{p}-\mathbf{p}_0| = \sqrt{(x-x_0)^2 + (y-y_0)^2 + (z-z_0)^2}= \dfrac{p}{1 + \varepsilon\cos\theta},
$$
where $$\theta = \operatorname{atan2}\big(\mathrm{Proj}_{\mathbf{a}}(\mathbf{p}-\mathbf{p}_0), \mathrm{Proj}_{\mathbf{b}}(\mathbf{p}-\mathbf{p}_0) \big),$$
which is the atan2 of projections of the position vector $\mathbf{p}-\mathbf{p}_0$ onto the major axis vector $\mathbf{a}$ and minor axis vector $\mathbf{b}$ respectively. Also the point on this ellipse must satisfy the constraint:
$$
\mathbf{n}\cdot(\mathbf{p}-\mathbf{p}_0) = n_1(x-x_0)+n_2(y-y_0)+n_3(z-z_0) =0,
$$
which means the ellipse is living on this plane with normal $\mathbf{n}$.

Other than this natural extension, you can view ellipse in 3D as the intersection curve between a cylinder and a plane. The rotation of the plane can be represented by a rotation matrix. For example, if we rotate some object about the $z$-axis by $\alpha$ counter-clockwisely, then the original $(x,y,z)$ on this object becomes:
$$
\begin{pmatrix}
\cos\alpha & -\sin\alpha & 0
\\
\sin\alpha & \cos\alpha & 0
\\
0 & 0 &1
\end{pmatrix}
\begin{pmatrix}
x\\ y \\ z
\end{pmatrix} = 
\begin{pmatrix}
x\cos\alpha - y \sin\alpha\\ x\sin\alpha + y\cos\alpha \\ z
\end{pmatrix}.\tag{1}
$$
For example the plane spanned by the original major axis and minor axis vectors $\mathbf{a} = \langle a,0,0\rangle$ and $\mathbf{b}= \langle 0,b,0\rangle$ can be parametrized using two parameters $u,v$:
$$
\langle x-x_0,y-y_0,z-z_0\rangle = u \mathbf{a} + v \mathbf{b},
$$
i.e.,
$$
\begin{cases}
x = x_0 + u a_1 + v b_1
\\
y = y_0 + u a_2 + v b_2
\\
z = z_0 + u a_3 + v b_3
\end{cases}
$$
then we can transform this plane by rotation around $x$-, $y$-, or $z$-axis, by matrix in (1), plugging the new $x',y',z'$ obtained to any cylinder equation $(x-p)^2 + (y-q)^2 = r^2$ you will get a 3D ellipse as well.  
A: If I understand correctly, you are interested in the parametric equation of an ellipse in 3D. Such an equation can be written with the following data: 


*

*its center $(x_0,y_0,z_0)$ 

*an endpoint of its major axis $(x_a,y_a,z_a)$

*an endpoint of its minor axis $(x_b,y_b,z_b)$


Namely, 
$$
 \begin{split}
x&=x_0+(x_a-x_0)\cos t+(x_b-x_0)\sin t \\
y&=y_0+(y_a-y_0)\cos t+(y_b-y_0)\sin t \\
z&=z_0+(z_a-z_0)\cos t+(z_b-z_0)\sin t 
\end{split}
 $$
The polar form is less suitable for this purpose, because polar coordinates in a plane that is not parallel to any 3D coordinate  plane do not have a nice relation to $x,y,z$ or other standard coordinate systems.
