• strict warning: Non-static method view::load() should not be called statically in /home/peco/webapps/dp6_peter/sites/default/modules/views/views.module on line 906.
  • strict warning: Declaration of views_handler_argument::init() should be compatible with views_handler::init(&$view, $options) in /home/peco/webapps/dp6_peter/sites/default/modules/views/handlers/views_handler_argument.inc on line 744.
  • strict warning: Declaration of views_handler_filter::options_validate() should be compatible with views_handler::options_validate($form, &$form_state) in /home/peco/webapps/dp6_peter/sites/default/modules/views/handlers/views_handler_filter.inc on line 607.
  • strict warning: Declaration of views_handler_filter::options_submit() should be compatible with views_handler::options_submit($form, &$form_state) in /home/peco/webapps/dp6_peter/sites/default/modules/views/handlers/views_handler_filter.inc on line 607.
  • strict warning: Declaration of views_plugin_style_default::options() should be compatible with views_object::options() in /home/peco/webapps/dp6_peter/sites/default/modules/views/plugins/views_plugin_style_default.inc on line 24.
  • strict warning: Declaration of views_plugin_row::options_validate() should be compatible with views_plugin::options_validate(&$form, &$form_state) in /home/peco/webapps/dp6_peter/sites/default/modules/views/plugins/views_plugin_row.inc on line 134.
  • strict warning: Declaration of views_plugin_row::options_submit() should be compatible with views_plugin::options_submit(&$form, &$form_state) in /home/peco/webapps/dp6_peter/sites/default/modules/views/plugins/views_plugin_row.inc on line 134.
  • strict warning: Non-static method view::load() should not be called statically in /home/peco/webapps/dp6_peter/sites/default/modules/views/views.module on line 906.

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.

Topics:

Comments

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,

Blue

Hi! Thanks for the hint : ) ) I spent 30 minutes trying to understand why by using theta angle I couldn't find the right dot on the ellipse, I knew I was doing something wrong .. and after googling I immediately found your post and solved the problem immidiately.. Thank you for sharing in your blog!

Post new comment

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