• ### What is your GameDev Story?

#### Archived

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

# ahh...geometry

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

## 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 on other sites
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 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

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

##### Share on other sites
Exactly. Just make sure to convert everything to radians and it''ll work fine.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 17
• 14
• 10
• 9
• 11
• ### Forum Statistics

• Total Topics
634094
• Total Posts
3015499
×