In: Advanced Math
How do you do a 90 degree counter-clockwise rotation around a point? I know around the origin it's (−y,x), but what would it be around a point?
Given any point p=[xy] and a center of rotation c=[ab] we can construct the vector d =p−c which is the vector that goes from p to c.
Then we can create a rotation matrix T=[cosθsinθ−sinθcosθ] where θ is the counter-clockwise rotation angle.
Then the rotated point p′ is given by
p′=Td+c
For your example, d =[x−ay−b], T=[01−10] and c=[ab], so
p′=[b−yx−a]+[ab]=[a+b−yx+b−a]
(y,-x)