C++: Rotating a vector around a certain point
问题 I am trying to rotate a vector around a certain point on the vector(in C++): 1 2 3 4 5 6 7 8 9 rotated around the point (1,1) (which is the "5") 90 degrees would result in: 7 4 1 8 5 2 9 6 3 Right now I am using: x = (x * cos(90)) - (y * sin(90)) y = (y * cos(90)) + (x * sin(90)) But I don't want it rotated around (0,0) 回答1: As Mehrdad Afshari commented on Pesto's post, including the translation back into the original coordinate system would be: x_rotated = ((x - x_origin) * cos(angle)) - ((y