There are Two Points A and B. The linear distance between the points is R.
I have the coordinates of both points given as X and Y values, and these points can be anywhare in on the 2D plane.
I need to rotate Point A around point B for a given angle (for example 12.56 deg) and get the X and Y coordinates of the new location. The rotation is clockwise.
How can these new X and Y coordinates be calculated?
Thanks!
Hint: If you know how to rotate about the origin, you have to calculate (using pseudo code notation) $$(X,Y) = (B_X, B_Y) + \mathrm{rotate\_origin}(A_X-B_X, A_Y-B_Y)$$
Edit: For 2D rotations you use http://en.wikipedia.org/wiki/Rotation_matrix#In_two_dimensions and remember to convert your angle to radians before using $\cos, \sin.$ $$X = B_X + (A_X-B_X)\cos\phi - (A_Y-B_Y)\sin \phi $$ $$Y = B_Y + (A_X-B_X)\sin\phi + (A_Y-B_Y)\cos \phi $$