[Math] Finding the point on a rotated ellipse corresponding to a given tangential angle

conic sectionsgeometry

I was going to initially ask for the solution to this problem here, but I have come upon a solution by some hand derivation and wanted to verify it here. Please note that after high-school I have had no formal training in mathematics so the proof is not rigorous and sort of umbral, since I'm just feeling my way through to what the truth should be.

So since I'm supposed to ask a question on this forum, here goes: How is the following derivation of a formula valid? I will draw your attention to the specific part of the derivation I am doubtful about. An alternate question would be: is there a more proper rigorous derivation for the following solution:

Problem: Given an ellipse centered at the origin with major radius $a$ and minor radius $b$ and (whose major axis is) rotated w.r.t. the X axis by an angle of $\alpha$, find the point on the ellipse where the tangential angle is $\psi$.

Solution:

First rotate the ellipse by $-\alpha$ to simplify things. At the end, we can just rotate the point back by $\alpha$ and it will be OK. Now the required tangential angle will also be $ \psi – \alpha = \phi$ (say).

The parametric form of the unrotated ellipse centered at the origin is $x = a \cos t$ and $y = b \sin t$. If we find out the parameter $t$ corresponding to the tangential angle $\phi$ we can calculate $x$ and $y$.

Now from the parametric form:

$$ x = a \cos t ; y = b \sin t $$

Differentiating to find the velocity (tangent) vector:

$$ { dx \over dt } = -a \sin t ; { dy \over dt } = b \cos t $$

The angle $\phi$ the above vector subtends with the positive x axis is:

$$ \phi = atan2 ( b \cos t, -a \sin t ) $$

where $atan2$ is the computer-style function with appropriate quadrant detection, and which takes the y part first.

Now the above implies:

$$ {{ b \cos t } \over { -a \sin t }} = \tan \phi $$

$$ \Rightarrow {b\over{-a}} \cot t = \tan \phi $$

$$ \Rightarrow {b\over{-a}} \tan ( { \pi \over 2 } – t ) = \tan \phi $$

$$ \Rightarrow \tan ( { \pi \over 2 } – t ) = {{-a}\over b} \tan \phi $$

$$ \Rightarrow { \pi \over 2 } – t = atan2 ( -a \sin \phi, b \cos \phi ) $$

$$ \Rightarrow t = { \pi \over 2 } – atan2 ( -a \sin \phi, b \cos \phi ) $$

However, using this formula in my program (OK that's where it's going finally but this is really about the formula) I found that I had to move that $-$ from the y part to the x part otherwise my calculation was off by $180^\circ$ and this is what I am seriously having doubts about:

$$ \Rightarrow t = { \pi \over 2 } – atan2 ( a \sin \phi, -b \cos \phi ) $$

So substituting this $t$ value, one can get the point from the generic parametric equation by additionally rotating back by $\alpha$:

$$ x = a \cos t \cos \alpha – b \sin t \sin \alpha ; y = a \cos t \sin \alpha + b \sin t \cos \alpha $$

So again the question: how does the above solution work, or what is a better more proper rigorous derivation of a solution to the problem?

I should also note that http://mathworld.wolfram.com/Ellipse.html eqn 60 gives the relation between $phi$ and $t$ as:

$$ \phi = \tan ^{-1} ( {a \over b} \tan t ) $$

which however means:

$$ \tan \phi = {a \over b} \tan t $$

$$ \Rightarrow {b \over a} \tan \phi = \tan t $$

$$ \Rightarrow t = \tan ^{-1} ( {b \over a} \tan \phi ) = atan2 ( b \sin \phi, a \cos \phi ) $$

which does not tally with my above result and does not work correctly if I use in my program. Please help. Thank you!

Best Answer

What I'd do

I read up to $\phi=\psi-\alpha$ and agree with that. I'm spinning my own thoughts from that point on. For the moment I'd like to think of your tangent direction not as an angle but as a direction vector instead, namely the vector

$$ v_1 = \begin{pmatrix} \cos\phi \\ \sin\phi \end{pmatrix} $$

Now you can take your whole scene and scale all $x$ coordinates by $a$ and all $y$ coordinates by $b$. This will turn your ellipsis into a unit circle, and the tangent direction will become

$$ v_2 = \begin{pmatrix} \frac{\cos\phi}a \\ \frac{\sin\phi}b \end{pmatrix} $$

Now you're looking for the point on the unit circle with this tangent. This is particularly easy, since tangents to the unit circle are perpendicular to radii. Simply take your vector, swap $x$ and $y$ coordinate and also swap one sign. That will result in a perpendicular vector

$$ v_3 = \begin{pmatrix} \frac{\sin\phi}b \\ -\frac{\cos\phi}a \end{pmatrix} $$

Now you have to change the length of that vector to $1$ so you get a point on the unit circle.

$$ v_4 = \frac{v_3}{\lVert v_3\rVert} = \frac{1}{\sqrt{\left(\frac{\sin\phi}b\right)^2 + \left(\frac{\cos\phi}a\right)^2}} \begin{pmatrix} \frac{\sin\phi}b \\ -\frac{\cos\phi}a \end{pmatrix} = \begin{pmatrix} x_4 \\ y_4 \end{pmatrix} $$

Note that at this point, the opposite point $-v_4$ is a second valid solution. Now you can scale your coordinates back by $a$ and $b$ and end up with

$$ v_5 = \begin{pmatrix} a\cdot x_4 \\ b\cdot y_4 \end{pmatrix} $$

Last you'd apply the rotation by $\alpha$ to that (and possibly $-v_5$ as well).

What you did

So now that I've thought about how I'd think about this, I'll have a look at the rest of what you did. It seems that your computations look a lot shorter than mine, so they might be more efficient for practical uses. Nevertheless, my approach might yield some insight as to what the individual steps do, so I'll leave it in place and even refer to it.

I found that I had to move that $−$ from the $y$ part to the $x$ part otherwise my calculation was off by $180°$

If your tangents are unoriented lines, then a change in $180°$ in that argument will give an equally valid result. This is the $v_4$/$-v_4$ ambiguity in my solution. The “velocity vector” you used is oriented, pointing in a given direction, but if you move along your circle in the opposite direction, you'd get opposite velocities at the same points.

So again the question: how does the above solution work, or what is a better more proper rigorous derivation of a solution to the problem?

Your solution looks good. You might want to consider $t$ and $t+180°$, and if you do, then it shouldn't matter where you place your minus sign. If you still have doubts, however, feel free to implement my approach as an alternative and compare the results. They should agree.

I should also note that http://mathworld.wolfram.com/Ellipse.html eqn 60 gives the relation between $\phi$ and $t$ as […]

Their $\phi$ is the “polar angle” of a point on the ellipsis. Look at the line connecting the center of the ellipsis with a given point on the ellipsis. The angle that line makes with the $x$ axis is their $\phi$.