Jump to content
  • Advertisement
Sign in to follow this  
amish1234

unit circle - ellipse

This topic is 5399 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

For the circle, we all know that the blue point is (cos(theta), sin(theta)). On the ellipse, I'm trying to think of a way to define the blue point in terms of theta. Here's what I tried: ( cos(theta)*XRadius, sin(theta)*YRadius ) But this didn't work. Any ideas?

Share this post


Link to post
Share on other sites
Advertisement
The parameterization (x = a cos Θ, y = b sin Θ) will work, in that it will trace out the ellipse for 0 <= Θ < 2π, except that the angle between the vector connecting the origin to (x, y) and the x-axis will NOT be Θ. If you really need a point in terms of Θ, then you'll have to go back to cartesian coordinates and then back again to polar coordinates:

(x / a)2 + (y / b)2 = 1
(r cos Θ / a)2 + (r sin Θ / b)2 = 1
r2 * (cos2 Θ / a2 + sin2 Θ / b2) = 1
r = 1 / sqrt(cos2 Θ / a2 + sin2 Θ / b2)
x = r cos Θ
y = r sin Θ

It's not pretty, which is why your original parameterization is best.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
a = atan2(sin(theta)*YRadius, cos(theta)*XRadius);
x = cos(a)*XRadius;
y = sin(a)*YRadius;

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Sorry, should be:

a = atan2(sin(theta)*XRadius, cos(theta)*YRadius);

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!