Jump to content
  • Advertisement
Sign in to follow this  

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.

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

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 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!