I'm struggling to understand how the equations below are arrived at
for a rotation around the Z-axis:
x' = x cos theta - y sin theta
y' = etc...
This is how I understand it...
I have a point P in a 2D cartesian space that I want to rotate around
the origin to P'.
I know the values of P(x,y) and the angle of rotation (theta) and I
want to find the x,y co-ordinates of the new point P'.
The x and y components of P form a triangle as do those of P'
/ | Height = Py
Base = Px
The hypotenuse (r) of the 'P triangle' above formed by the point P and
the origin is :
r = (Px^2 + Py^2)^0.5
So I now have the length of r which is the hypotenuse of my P and P'
To find P'x i need one extra piece of information, either the length
of another side or an angle.
Using an angle - i need the angle between the x-axis and P'r (the
hypotenuse of P'):
to do this i need to:
1) Calculate the angle formed by my P triangle between the x-axis and
P r (the hypotenuse of P) - lets call this angle A
2) Add this angle to the known angle of rotation (A')
1 - I can calculate the angle A by doing the following:
tan(A) = Py/Px
so A = arctan(Py/Px)
2 - If i then add angle A to the angle of rotation (A') i get the
angle formed by my P' triangle between the x-axis and the hypotenuse
of P' which we will call angle A + A' so i can think about calculating
P'x as follows...
P'x = P'r * Cos(A + A')
Finally P'Y can be calculated using pythagoras's theorem or using sin
P'Y = P'r * sin(A + A')
so my question is how do I get from
x' = P'r * cos(A + A')
y' = P'r * sin(A + A')
x' = x cos(theta) - y sin theta etc...
Thanks (very) musch in advance,