Find new coordinates of a point after rotation

math

Solution

If `a` is an angle in radians of a counterclockwise rotation, then the new coordinate (x',y') is

x' = x*cos(a) - y*sin(a)
y' = x*sin(a) + y*cos(a)

If `a` is an angle in radians of a clockwise rotation, then the new coordinate (x',y') is

x' =  x*cos(a) + y*sin(a)
y' = -x*sin(a) + y*cos(a)

If the angle you're given is in degrees `d`, then convert to radians `a` first via

a = d * pi / 180

Problem

Suppose i have a rectangle of dimension w*h , and let there is an arbitrary point inside this rectangle at position (x,y) , now i rotate this rectangle to X degree, What will be the new position of that arbitrary point after rotation..

Original source