DJ_AM_Juicebox
asked on
Rotate a 2d point around another point?
Hi,
I have two 2d points. I want to rotate one point around the other. How do I do this? Here is my input:
Point pt1 = (100, 100);
Point pt2 = (100, 130);
Now rotate pt2 around pt1 by 17 degrees.
Yeah I basically need that to work with variable pt1 and pt2 and degrees of 0 to 360. Not sure how to do this,
Thanks
I have two 2d points. I want to rotate one point around the other. How do I do this? Here is my input:
Point pt1 = (100, 100);
Point pt2 = (100, 130);
Now rotate pt2 around pt1 by 17 degrees.
Yeah I basically need that to work with variable pt1 and pt2 and degrees of 0 to 360. Not sure how to do this,
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I hope this link will be helpful:
http://en.wikipedia.org/wiki/Rotation_(mathematics)
http://en.wikipedia.org/wiki/Rotation_(mathematics)
hey DJ_AM_Juicebox,
in addition, do you need the generalised matrix-form? its
m = m_trans_pt1 * m_rot(phi) * m_trans_pt1_inv
basically its the same as the above comments say..
tell us if you need help creating those matrices ..
ike
in addition, do you need the generalised matrix-form? its
m = m_trans_pt1 * m_rot(phi) * m_trans_pt1_inv
basically its the same as the above comments say..
tell us if you need help creating those matrices ..
ike
If so, translate your coordinate system so that pt1 = (0,0). Pt2 then = (0,30)
Rotate coord system 17 degrees. Translate coord system back to original location. You are done.