I have the parametric equation of an ellipse in this form:
$$x(t)= a\cos(t)$$
$$y(t)=b\cos(t+\phi)$$
It's an ellipse centred about the origin, with a tilt angle. So three parameters.
How can I convert it to the form:
$$x(t)=A\cos(t)\cos(\Phi)-B\sin(t)\sin(\Phi)$$ $$y(t)=A\cos(t)\sin(\Phi)+B\sin(t)\cos(\Phi)$$
i.e. the ellipse formula with a rotation through $\Phi$? I obviously need to get $A$, $B$, and $\Phi$ in terms of $a$, $b$ and $\phi$, but I can't see how to do it.
So we have a pair of equations $$ a \cos (t+\tau) = A \cos t \cos \Phi - B \sin t \sin \Phi\\ b \cos (t+\tau+\phi) = A \cos t \sin \Phi + B \sin t \cos \Phi $$ which need to be equal for every $t \in \mathbb R$. Since both of the formula produce an ellipse when $t$ runs over $[u, u+2\pi]$ for any $u$, the value $\tau$ denotes the parameter shift between the parametrizations. Expanding the LHS we get $$ a \cos t \cos \tau - a \sin t \sin \tau = A \cos t \cos \Phi - B \sin t \sin \Phi\\ b \cos t \cos(\tau+\phi) - b \sin t \sin (\tau + \phi)= A \cos t \sin \Phi + B \sin t \cos \Phi. $$ Eliminating $t$ gives a system of 4 equations: $$\begin{aligned} a \cos \tau &= A \cos \Phi &\qquad(1)\\ a \sin \tau &= B \sin \Phi &\qquad(2)\\ b \cos (\tau + \phi) &= A \sin \Phi &\qquad(3)\\ b \sin (\tau + \phi) &= -B \cos \Phi &\qquad(4) \end{aligned} $$ which need to be solved for $\tau, A, B, \Phi$. Squaring and adding $(1)$ and $(2)$ and the same for $(3), (4)$ gives $$ a^2 = A^2 \cos^2 \Phi + B^2 \sin^2 \Phi\\ b^2 = A^2 \sin^2 \Phi + B^2 \cos^2 \Phi $$ and adding and subtracting those give $$\begin{aligned} a^2 + b^2 &= A^2 + B^2\\ a^2 - b^2 &= A^2 \cos 2\Phi - B^2 \cos 2\Phi \end{aligned} $$ Also by $(1)\times(3) + (2)\times(4)$ $$ ab \left( \cos \tau \cos (\tau + \phi) +\sin \tau \sin (\tau + \phi) \right) = (A^2 - B^2) \cos \Phi \sin \Phi\\ 2ab \cos \phi = (A^2-B^2) \sin 2\Phi. $$ So $$ A^2 + B^2 = a^2 + b^2\\ (A^2 - B^2) \cos 2\Phi = a^2 - b^2\\ (A^2 - B^2) \sin 2\Phi = 2ab\cos \phi $$ Solving the system gives $$ \Phi = \frac{1}{2}\arctan \frac{2ab\cos \phi}{a^2 - b^2}\\ A^2 + B^2 = a^2 + b^2\\ A^2 - B^2 = \pm\sqrt{(a^2 - b^2)^2 + 4a^2b^2 \cos^2 \phi} = \pm\sqrt{a^4 + b^4 + 2a^2b^2\cos 2\phi}. $$ Care should be taken when choosing correct sign. Actually the sign interchanges the $A$ and $B$. Wrong sign rotates the ellipse by $\frac{\pi}{2}$. One may also add $\frac{\pi n}{2}$ to the $\Phi$ and fix the sign.
Example $a = 1, b = 2, \phi = \frac{\pi}{3}$ $$ \Phi = -\frac{1}{2}\arctan \frac{2}{3}\approx -0.294\\ B = \sqrt{\frac{5+\sqrt{13}}{2}} \approx 2.07431\\ A = \sqrt{\frac{5-\sqrt{13}}{2}} \approx 0.83500\\ $$ I've plotted both curves for $t \in \left[0, \frac{15}{8}\pi\right]$ so you can see where the cut is.
