#### Archived

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

# X/Y Co-ords after rotation

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

## Recommended Posts

I have an image in the centre of the screen. And I have drawn the image at its centre point and can rotate the image by prssing left/right. Now I also have 2 variables which store the top centre of the object, and the bottom centre of the object. I would like to know how to calculate these exact same points (top/bottom centre of image) when the image is rotated. I am guessing a formula using Sin/Cos and the angle the car is rotated at is the order of the day, but I am at a loss and maths isnt my strong point =( Thanks for any help.... If you need a better explanation, just say! r!K

##### Share on other sites
You mean like this?

+--A--+|     ||     ||     |+--B--+ `

x = oldx*cos(Angle) - oldy*sin(Angle)
y = oldx*sin(Angle) + oldy*cos(Angle)

But you must be doing something like this if youre already rotating it right? Maybe not.

If you have the corner points already then the center points are just:

x = (x1+x2)/2
y = (y1+y2)/2

where (x1,y1) and (x2,y2) are the adjacent corners.

Tell me if I''ve misunderstood you.
ro

1. 1
2. 2
Rutin
20
3. 3
khawk
16
4. 4
A4L
14
5. 5

• 11
• 16
• 26
• 10
• 11
• ### Forum Statistics

• Total Topics
633756
• Total Posts
3013707
×