# Rotation around arbirary point in 2D space

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

## Recommended Posts

Hello ! Probally my question is quite easy, and I'm sorry to bother yours with such easy things, but I always had a problems with geometry :-) I'm writing GPS-alike plugin for X-Plane flight simulator. The idea behind it is, the plugin receive WGS84 coordinates of navigation points from simulator, and then projects them into planar surface (the screen of GPS receiver in my case). Assuming that simulated geo-sphere is ideal sphere, I do Geodesy -> Cartesian coordinate convertion using next code: void GeoToXY (double lat, double lon, double *outX, double *outY) { double R = 6378.0; *outX = R * cos((-lon*PI)) * cos((lat*PI)); *outY = R * sin((lat*PI)); } where R is radius of the Earth. And it seems this code is working right, I'm able to see all pre-programmed Nav-aids in right order in right place on 2D surface. However, since I'm using "direct projection" (assuming the aircraft "stay in place, and world is moving around it"), I have to rotate my projected navigation points around the aircraft position. The problem is that, the aircraft position is far not 0,0, it can be anything, since I receive it's position as WGS, and convert it to cartesian too. So, the question is, how to rotate a points(navaids) in planar space around a given point(aircraft) ? I tried x' = dist*sin(angle) / y' = dist*cos(angle) ,where dist is the distance from the aircraft to a point, but it wasn't worked (every position was screwed up). Any help will be highly appreceated!

##### Share on other sites
Problem solved :-)

I completely forgot about

x' = xcos(a) - ysin(a)
y' = xsin(a) + xcos(a)

1. 1
2. 2
Rutin
19
3. 3
khawk
18
4. 4
5. 5
A4L
11

• 12
• 16
• 26
• 10
• 44
• ### Forum Statistics

• Total Topics
633768
• Total Posts
3013743
×