Sign in to follow this  
web_scripter

coordinate conversion

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this