# Plotting a skew ellipse

I tried to make a geometers sketchpad toolkit for spherical geometry that is more exact (and easier to understand) than the present available one.

but then I soon realised my background is not good enough so I need some help.

so my first (of a lot) of problems.

To plot a great circle

a great circle is an ellipse with:

• the centre is at the origin (0,0)
• the length of the semi-major axis is 1 (the ellipse touches the unit circle)
• the length of the semi-minor axis is $h$ ($0 \le h \le 1$ )
• the angle between the (positive) x axis and the major axis of the ellipse is $\alpha$

What are the coordinates as a parametric function of the angle between the point, origin, X axis?

(I need get two functions x = some function (t) and y= some other function (t) where $t$ is the angle x-axis, origin , point on ellipse.

Second problem

Given two points $A (a_x, a_y)$ and $B (b_x, b_y)$ in the unit disk's interior, then there is a unique ellipse that:

• containins A and B.
• the semi-major axis is 1,
• the semi-minor axis is less than 1,
• the arc of the ellipse from A to B does not meet the major axis.

What is the formula of this ellipse?

More to come but this will help me on my way (any references to books are very welcome)

• To do spherical geometry, it seems you'd want to represent and compute with great circles (and points) in three dimensions, then project them to the plane, rather than plotting directly to the plane...? In any case, Patrick Ryan's Euclidean and Non-Euclidean Geometry may be worth a look. – Andrew D. Hwang Aug 23 '15 at 12:28
• no just a direct plot on the plane , no need to go into the 3rd dimension – Willemien Aug 23 '15 at 12:41
• There's no need to go to the third dimension; I agree with Andrew (having written such software myself several times over the last 40 years) that actually representing things on the sphere leads to far simpler code in general. But if you're sure that's wrong, go for it and do it in the plane -- it's not a whole lot more tougher. – John Hughes Aug 23 '15 at 13:20
• First learn about great circle orbit inclination... relation between longitude and latitude in spherical coordinates. Later about projections of point on principal planes. – Narasimham Aug 23 '15 at 14:18

Part 1: \begin{align} x(t) &= \cos(\alpha) \cos(t) - h\sin(\alpha) \sin(t) \\ y(t) &= \sin(\alpha) \cos(t) + h\cos(\alpha) \sin(t) \end{align}

I don't understand the question for part 2. Are the two point supposed to be on the ellipse? If so, then $h$ and $\alpha$ cannot be determined, because there can multiple ellipses at the origin containing the same two points. (Quick proof: draw a (non-circular) ellipse $E$ at the origin. Rotate it by 30 degrees to get another ellipse $E'$. Now look at $E \cap E'$. It will typically contain four points. If any two of these are called $A$ and $B$, then both $E$ and $E'$ are possible solutions to the "find $h$ and $\alpha$" problem, but the $\alpha$ values for $E$ and $E'$ differ by 30 degrees.

Post-comment remarks

The squared distance from $(x(t), y(t))$ to $(0,0)$ is \begin{align} d(t)^2 &= \left[\cos(\alpha) \cos(t) - h\sin(\alpha) \sin(t)\right]^2 + \left[\sin(\alpha) \cos(t) + h\cos(\alpha) \sin(t)\right]^2 \\ &= \cos^2(\alpha) \cos^2(t) + h^2\sin^2(\alpha) \sin^2(t) - 2h\cos(\alpha) \cos(t)\sin(\alpha) \sin(t) + \sin^2(\alpha) \cos^2(t) + h^2\cos^2(\alpha) \sin^2(t) + 2h\cos(\alpha) \cos(t)\sin(\alpha) \sin(t) \\ &= (\cos^2(\alpha) + \sin^2(\alpha)) \cos^2(t) + h^2(\sin^2(\alpha) + \sin^2(t)) \sin^2(t) \\ &= \cos^2(t) + h^2 \sin^2(t) \end{align} This varies from $1$ (at $t = 0$) to $h^2$ (at $t = \frac{\pi}{2}$). Hence one (semi-) axis has length $1$ and the other has length $h$. If $h < 1$, then the major (semi-)axis will have length $1$.

Note that at $t = 0$, we have  \begin{align} x(0) &= \cos(\alpha) \cos(0) - h\sin(\alpha) \sin(0) &= \cos(\alpha) \ y(0) &= \sin(\alpha) \cos(0) + h\cos(\alpha) \sin(0) &= \sin(\alpha) \end{align} which is an angle $\alpha$ from the positive $x$-axis, as required.

It's possible that you still don't believe me, so here's some Matlab code:

function y = ellipseTest()
hList = [0.1, 0.3, 0.7];            % three different eccentricities
alphaList = [20, 50, 130] * pi/180; % three different major-axis angles
t = linspace(0, 2*pi, 100);         % sample values from 0 to 2pi
colorList = ['r', 'g', 'b'];
figure(gcf);
clf;
hold on

for i = 1:3
h = hList(i); alpha = alphaList(i); color = colorList(i);

x = cos(alpha) * cos(t)  - h * sin(alpha) * sin(t);
y = sin(alpha) * cos(t)  + h * cos(alpha) * sin(t);
plot(x, y, color)
end
hold off;
set(gca, 'DataAspectRatio', [1 1 1]);
figure(gcf);


and the resulting figure: I find these pretty compelling.

Note that each pair of ellipses intersects in two points in the first quadrant, so if you picked one of these sets-of-two-points for your part 2 question, you'd find two different ellipses that fit them.

• thanks , but it looks incorrect ( the major axis is not fixed at 1) and the angle also looks incorrect. For point 2 i need to think about that , something that the arc connecting them does not intersect with the major axis) – Willemien Aug 23 '15 at 11:58
• Can you say why it looks incorrect? I've added comments to show that in fact the distance to the origin varies from $1$ to $h$; if $h \le 1$, then the major (semi-) axis is indeed 1. (If you want the major axis to have length 1, then you need to include a factor of $1/2$ in both $x$ and $y$). I've also shown that this major axis point lies at an angle of $\alpha$ from the positive $x$-axis (again in the $h \le 1$ case). – John Hughes Aug 23 '15 at 13:18
• Note that your suggest method to address my counterexample for part 2 doesn't actually work: Pick two points on the unit circle at, say, angles 40 and 50 degrees from the $x$-axis. You can find a whole family of ellipses of varying eccentricity, all symmetric about the $45$-degree line, that pass through those two points. – John Hughes Aug 23 '15 at 13:27
• sorry i mixed up my cos and sins, sorry , about your counter example for part 2 only the unit circle connects them (for all all others ellipses the major axis > 1) for points inside the unit circle i think there are only two ellipse that have a major axis of 1 (and only one where the major axis is not between the two points. ps $h$ does not stands for the excentricity is stands for half the length of the minor axis, the length of the major axis is fixed) . – Willemien Aug 23 '15 at 14:01
• The ratio of the semi-axis lengths is the eccentricity; if $h > 1$, then the eccentricity is $h$; if $h < 1$, then the eccentricity is $1/h$. Your revised conjecture seem to be this: "Given points $A, B$ in the unit disk's interior, there's a unique ellipse with semi-major axis 1, and semi-minor axis no greater than 1, containing $A$ and $B$, and such that the each arc of the ellipse from $A$ to $B$ does not meet the major axis." Once you restrict to say that the segment $AB$ may not contain the origin, I suspect this might be true...at least dimension-counting suggests that. Good luck! – John Hughes Aug 23 '15 at 14:15