Jump to content
  • Advertisement
Sign in to follow this  

coordinate conversion

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

I was wondering how i could convert rectangulare coordinates by 45 degress to the right. I do not want to move anything i just want to convert a point at 100,50 in rectangulare coordinates into a rectangulare coordinate system rotated by 45 degrees. this is what i found x1,y1 are the new coordinates and x,y are the current coordinates x1 = x*cos(45) + y*sin(45); y1 = -x*sin(45) + y*cos(45); for some reason that equation actually moves the point. I maybe doing some thing wrong in my code but i don't think that equation is right. thanks for any help that can be provided.

Share this post


Link to post
Share on other sites
Advertisement
An old equation that I used for an old project was:

x1 = cos(theta)*x - sin(theta)*y;
y1 = sin(theta)*x + cos(theta)*y;

the only difference to your one is the minus sign in the x1 equation.
Also, I don't think that works when you are working with degrees, might need to use radians but cant remember :/

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!