In this rotating ellipse formula: $A(x − h)^2 + B(x − h)(y − k) + C(y − k)^2 = 1$

Suppose I have $A,B,C,h,k$ parameters, and I want to obtain the angle $θ$ from the centroid $(h,k)$ to the horizontal axis, at the red dot in this image:


There are two things I am concerning:

  1. Acquiring $θ$: I got the inverse tangent in my mind. If I can get the $(x',y')$ of the red dot, then this should be simple. However, before doing that, I am curious about the fastest way possible to calculate $θ$ in this case. If we have $A,B,C,h,k,$ what would be the fastest way to obtain $θ$?

  2. Due to the nature of an ellipse, both ends of each axis are the same. This implies $0$ degrees and $180$ degrees will look exactly the same visually, however, if possible, I would like to obtain this difference as well. Currently I do not know whether from the rotating formula above, can we obtain the whole $360$ degrees orientation, or only $0-180$? Can somebody please clear this?

  • 1
    $\begingroup$ I think, Israel's last answer could inspire you well for this setp. Nice point of view.+ $\endgroup$ – mrs Dec 24 '12 at 7:24

$h$ and $k$ don't matter. It looks like the red dot is on the major axis. So this is the angle $\theta$ of my answer to your last question. If $B \ne 0$,
$$ \theta = \arctan \left(\dfrac{C-A + \sqrt{(C-A)^2 + B^2}}{B} \right)$$

I'm not sure what you mean by your second question. What difference do you want to obtain if there is no difference? The formula above gives the $\theta$ that is in the interval $(-\pi/2, \pi/2)$ in radians, or $(-90, 90)$ in degrees.

  • $\begingroup$ I see. I was wondering whether I can get 0-360 degrees. But I see that from your answer, $\theta$ will be in interval (-90,90) in degrees. Also, from my current understanding, your formula will always be pointing at the major axis, right? $\endgroup$ – Karl Dec 24 '12 at 7:51
  • 2
    $\begingroup$ Yes, and yes. If you want an angle in a different range, you can always add 180 or 360 degrees. If you want the minor axis, add or subtract 90 degrees. $\endgroup$ – Robert Israel Dec 24 '12 at 8:13

Let me tackle your second question. I'll put it in this order:

I do not know whether from the rotating formula above, can we obtain the whole 360 degrees orientation.

[H]owever, if possible, I would like to obtain this difference as well.

First- No. Your formula does not distinguish positions 180° apart. This is a property of the formula, not the ellipse.

Second-- Yes it is possible. I see you have marked one end with a red dot. That'll do nicely. The trick is to measure in a way that preserves this difference. The following steps are fleshed out with working examples in

this Geogebra worksheet

1. Correction: Mr. Israel's formula gives the minor axis. For the Major, change the square root to negative. Below, I use $atan(-)$ and $atan(+)$ to mean "use Mr. Israel's formula, and take the negative (or positive) root."

2. In geometry, we give direction and orientation directly on the figure. In algebra, we use signed values. Here, the (pair of) equation(s)

$$Ax^2 + B x y + Cy^2 = ±1$$

are an ellipse when
   a)$B^2 - 4AC < 0$, and
    b) A, C, ±1 all have the same sign.
If you use $Ax^2 + B x y + Cy^2 = 1$, you must also restrict $A, C > 0$. atan(+) gives the major axis of the conjugate ellipse, $Ax^2 + B x y + Cy^2 = -1$.

3. atan(+), and atan(-) are 90° apart. When one jumps between ±π/2, the other crosses smoothly over 0. If we measure the difference between two nearby angles, one of the two changes of atan() will be continuous. This is

SOLUTION 1 - BLUE: Start with an initial position. Let $θ_0 =atan_0 (-).\;\;$, defining a point $P$ on the major axis in the range -90° < θ <90°. Rotate the ellipse by a small amount (change A, B C). Call the new position $θ_1$. To find it, calculate the change in angle:
  $dθ = atan_1 - atan_0$
  $θ_1 = θ_0 + dθ$

When atan(-) falls out of range, dθ leaps suddenly. Go back one step and use atan(+) (which will be in range) to measure dθ. When atan(+) jumps, go back to (-)... etc. Always use two consecutive values of the same function to calculate dθ. Now you can track θ over the full 360°. Since you're only using the change in angle, it doesn't matter if atan() is close to θ.

The worksheet follows the same principle, but I just use atan(-).

4. If I account for all points in this way, the BLUE solution always works. However, the ellipse $Ax^2 + B x y + Cy^2 = 1$ passing through $P$ is still discontinous under rotation. This is the

GREEN PROBLEM: I have drawn two ellipses. Both correctly track P over the full 360°. Geogebra uses your formula, then maps it to a path. This does not work. The Dot family is distributed at even intervals along a section of the arc. If you rotate the ellipse (point $Q$), they have a turbulent future.
The problem is this:

5. All motion is differential. Let me restate this observation slightly:

I'm not sure what you mean by your second question. What difference do you want to obtain if there is no difference?

I prefer: This equation is unorientable. One answer is to select a different representation. This is

6. SOLUTION 2 - BLACK: Point $P = r(t) = (x(t), y(t)),$ moves over time, beginning on the major axis (t=0). As t increases, it smoothly traverse the arc until it returns home (t= 2π). The unrotated ellipse is: $$r(t) = (a \cos t, b \sin t)$$

To rotate r(t), use the unit vector in the direction θ: $\vec e_θ = (\cos θ, \sin θ)$. The rotated ellipse is: $$r_2(t)= \begin{bmatrix}{} \cos θ & -\sin θ \\ \sin θ & \cos θ \end{bmatrix} \begin{bmatrix}{} a\cos t \\ b\sin t \end{bmatrix} $$ $$ = (a\cos θ \cos t - b\sin θ \sin t, \;\;a\sin θ \cos t + b\cos θ \sin t)$$

You can check by hand that, given an arbitrary point $r(t_0) = (x_0, y_0)$, the corresponding point $r_2(t_0)$ is rotated about the origin by θ. The matrix on the left is a rotation matrix.

The worksheet includes more steps, and alternate notation. Hopefully this is enough information to make the solution accessible, even if the notation is unfamiliar. I didn't use abstract notation because I like being abstract. In this case, it solves the problem: The Dot family is continuous, you can correctly relate points on the arc, and finding the rotation & measurements of the ellipse is faster and easier: you give them directly.

Hope that helps. As always, let me know if anything is confusing so I can make it better (more useful to you).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.