Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

LessThanJoe

ahh...geometry

This topic is 5791 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

Ok, here is what I want to do. I have a point somewhere on the screen. I have a radius of a circle and the angle formed between the top of the circle, the center, and the next point. Using this information, how could I find the coordinates of the point I want to go to next. It may help you to know that my goal is to have something rotate around a center point, and be able to move the centerpoing. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
The only difference between an angle with reference from the +X axis and on with reference from the +Y axis is that the latter angles are always 90° greater than those of the +X axis. The trig functions use the +X reference for calculations. Thus, to find this new point, you add 90° (or rather PI/2 radians) to the angle you are given, and find the sine and cosine of that angle. Multiply the cosine by the radius, add the center X, and you have your new X. Multiply the sine by the radius, add the center Y, and you have your new Y.

EDIT: In regards with the angle, you need to know if it goes to the "left" or the "right" so you know what the true angle would be from +Y.

[edited by - Zipster on December 6, 2002 2:24:26 AM]

Share this post


Link to post
Share on other sites
so it''d be something like


int oldx = DOESNTMATTER;
int oldy = DOESNTMATTER;
int newx = 0;
int newy = 0;
int angle = 90; // degrees
int radius = 70;

newx = radius * cosine(angle + 90) + oldx;
newy = radius * sine(angle + 90) + oldy;

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!