find the change in coordinate of a point inside rectangle if coordinates of rectangle change

lets consider a point O$(x,y)$ inside a rectangle of having coordinates - a$(x_1,y_1)$, b$(x_2,y_2)$, c$(x_3,y_3)$, d$(x_4,y_4)$.

How to calculate the new coordinates of O$(x,y)$ if coordinates of rectangle change (i.e if rectangle moves or rotate with point) length of edges does not change.

• Find the distance of translation by comparing their centres; find the rotation by comparing the slope of their diagonals. – Kenny Lau May 5 '16 at 9:05

This is a simpler method:

Find the distance of translation by comparing their centres:

The old centre is essentially $\displaystyle\left(\frac{x_1+x_2+x_3+x_4}4,\frac{y_1+y_2+y_3+y_4}4\right)$.

The new centre can be found by the same method.

Then, find the rotation by comparing the slope of any side:

The old slope of cd is $\displaystyle\frac{y_4-y_3}{x_4-x_3}$.

The new slope of cd can be found by the same method.

Then, calculate their angles of elevations respectively.

It is given by $\tan(\mbox{angle of elevation})=\mbox{slope}$.

After all that, you can translate O by the same distance and then rotate it by the same angle, relative to the new centre.

• I want the formula to calculate new O(x) and new O(Y) from given new a(x1,y1), b(x2,y2), c(x3,y3), d(x4,y4) – linna May 5 '16 at 9:36