Ok, so I've tried a few times to figure this out and keep getting the answer wrong. I've attached a picture to make it more clear.
You have a target point, which is relative to a missile. I want to find the target location relative to the tank turret's coordinate system.
target location relative to missile coordinate system = (8, -4)
tank location relative to missile coordinate system = (4, 0)
turret is rotated 45 degrees from the front of the tank
The coordinate system is X out the front of a vehicle and Y to the left
Using basic algebra, you can find the answer almost trivially. I want to understand the process when using rotation matrices.
I thought the answer should be -
R(-45)R(90)(target pos - tank pos)
Where R(x) represents the rotation matrix of x degrees.
I seem to end up getting the correct number (4* sqrt(2), 0), but I end up with it being negative, which isn't correct.
So what is the correct way of doing this?
PS - I was using column vectors, so my rotation matix looked like:
cos x -sin x
sin x cos x
so P2 = RP1
| x2 | = | cos x -sin x | | x1 |
| y2 | | sin x cos x | | y1 |