Calculate the new position of a point after rotating it around another point 2D
I have a point, whose location I know in Cartesian coordinates x and y. Now I need to calculate the coordinates of the point if it is rotated with another point as the centre of rotation, whose position I know too, for a known angle. How do I go about it?
This is in plane coordinate system.(i.e. 2D)
$\endgroup$2 Answers
$\begingroup$First, you have to translate $(x,y)$ to a new origin, that is$$ (x,y)\mapsto (x-\alpha,y-\beta) $$where $(\alpha,\beta)$ is the point around what you want to rotate.
Then you apply the rotation matrix to get$$ (x-\alpha,y-\beta) \mapsto (cos(\theta)(x-\alpha) -sin (\theta) (y-\beta), sin(\theta)(x-\alpha) +cos (\theta) (y-\beta)) $$where $\theta$ is the angle you want to rotate.
And finally, you translate back to the origin obtaining that $(x,y)$ gets transformed to
$$ (cos(\theta)(x-\alpha) -sin (\theta) (y-\beta)+\alpha, sin(\theta)(x-\alpha) +cos (\theta) (y-\beta) +\beta) $$
$\endgroup$ $\begingroup$Let $(x,y)$ be the point about which $(x_0,y_0)$ is rotating. Suppose the rotation angle is $\theta$ counterclockwise. Then we find the final position is given by$$(x_1,y_1) = (x,y) + r(\cos(\theta'), \sin(\theta'))$$Where $r = |(x,y)-(x_0,y_0)|$ and $\theta' = \theta + \arctan(y_0 - y, x_0-x)$
$\endgroup$ 2