Tangent to ellipse rotated in 3D with perspective I have an ellipse in 3D, with width $a$, height $b$, centered on $(0, 0, C)$ and parallel to the $xy$-plane.
I'm using a parametric equation with parameter $t$:
$x = a \cdot cos(t) \\
 y = b \cdot sin(t) \\
 z = C$
I rotate it by $\theta$ around the $z$-axis and then by $\phi$ around the $x$-axis to get:
$x_r = x \cdot cos(\theta) - y \cdot sin(\theta) \\
 y_r = (x \cdot sin(\theta) + y \cdot cos(\theta)) \cdot cos(\phi) - z \cdot sin(\phi) \\
 z_r = (x \cdot sin(\theta) + y \cdot cos(\theta)) \cdot sin(\phi) + z \cdot cos(\phi)$
Then I project it on the $xy$-plane with a perspective transform using some constant $p$:
$x_p = \dfrac{p \cdot x_r}{p + z_r} \\ \\
 y_p = \dfrac{p \cdot y_r}{p + z_r}$
Before applying perspective, I can calculate the tangent (in 2D) with:
$dx = x \cdot cos(\theta) + y \cdot sin(\theta) \\ \\
dy = (x \cdot sin(\theta) - y \cdot cos(\theta)) \cdot sin(\phi)$
How can I get an equation for the 2D tangent in terms of $t$ for the ellipse after the perspective transform has been applied?
 A: 
(Disclaimer: I have never worked with a perspective transformation before, and it's been a while since I've thought about rotating things in 3D space. But using the formulas provided in the question, I think I can provide an answer using basic principles of calculus.)

If we want to compute the slope of the tangent line of the projected curve given parametrically by
\begin{align}
x_p(t) &= \frac{p\,x_r(t)}{p+z_r(t)} \\
y_p(t) &= \frac{p\,y_r(t)}{p+z_r(t)}
\end{align}
we can do it by computing $dx_p/dt$ and $dy_p/dt$ and then using the fact that
$$ \frac{dy}{dx} = \frac{(dy/dt)}{(dx/dt)} $$
How do we compute those two derivatives? By a long application of the chain rule. I think trying to write out the entire expression for the derivatives would be unwieldy. Therefore I will not expand the new factors the chain rule gives us, but will provide the formulas to compute them. I don't know what the application of this question is, but if you'll be coding it up, this is probably the better way to do it.
Let us begin. First I'll compute $dx_p/dt$:$\newcommand{\indent}{\ \ \ \ \ \ }$
\begin{align}
\frac{dx_p}{dt} &= \frac{d}{dt} \left(\frac{px_r}{p+z_r} \right) \\
&= \frac{p\,x_r' \cdot (p+z_r) - px_r z_r'}{(p+z_r)^2} \indent \textrm{Quotient Rule}
\end{align}
where
\begin{align}
x_r' &= x' \cos \theta - y' \sin \theta \\
z_r' &= (x' \sin \theta + y' \cos \theta) \sin \phi
\end{align}
and
\begin{align}
x' &= -a \sin t \\
y' &= b \cos t
\end{align}
And $dy_p/dt$ looks the same just with $y_r$ instead of $x_r$:
$$ \frac{dy_p}{dt} = \frac{p\,y_r' \cdot (p+z_r) - py_r z_r'}{(p+z_r)^2} $$
where
$$ y_r' = (x' \sin \theta + y' \cos \theta) \cos \phi $$
If we go ahead and take the quotient of these two, we get a small simplification since their common denominators of $(p+z_r)^2$ will cancel:
\begin{align}
\boxed{\frac{dy_p}{dx_p} = \frac{py_r' \cdot (p+z_r)-py_r z_r'}{px_r' \cdot (p+z_r)-px_r z_r'}}
\end{align}
It may be that this can be further simplified if you plug in the corresponding expressions for the various variables in this expression, but from a cursory inspection, it doesn't look like it will.
