Finding the angle around an ellipse

When is the angle around an ellipse, not the around around the an ellipse? This is a problem which tripped me up a few times when working with elliptical orbits and arcs.

The problem

The issue is that we can (and often do) define the point on an ellipse at an angle, θ, with

x = a.cos(θ)
y = b.sin(θ)

Where a is the length of the axis aligned with the x-axis and b is the length of the axis aligned with the y-axis (I'm assuming the ellipse is oriented such that the axes). The problem is then, to find the angle, φ, around the ellipse to point (x, y).

With some simple trigonometry, we can see that:

tan(φ) = y / x
tan(φ) = b.sin(θ) / a.cos(θ)
tan(φ) = (b / a) * tan(θ)
φ = atan((b / a) * tan(θ))

Likewise, you can calculate the reverse with:

θ = atan((a / b) * tan(φ))

This is particularly useful for generating arcs in Processing.js where θ is used in the calculation for the angles to start and stop. If you want to find a point on the ellipse which aligns with another point (px, py), and the origin (say placing a planet on an elliptic orbit based on a mouse click), it's even easier.

θ = atan((a * py) / (b * px))

The hardest part of all this was realising that the angle I was using to define an elliptic arc was not the angle I expected.



Hey Peter! I'm Blue, an avid Khan Academy member, and I recently discovered the Guardian program and quickly decided I wanted to be one.

I got an email address, sent the person an email, and he responded saying that Khan Academy isn't hiring Guardians at the moment. I also heard that you're a Guardian, and I wanted to contact you, but I didn't have an email, so I just decided to message you on your blog.

I wanted to ask you-

If Khan Academy decided to start hiring again, how might I sign up to become a Guardian? I'd really love to know, as I really want to become one.


Thanks so much for reading/responding,


Post new comment

The content of this field is kept private and will not be shown publicly.