# Geometrical calculation to enlarge the height of rotated rectangle

There is a polygon (rotated rectangle) that defined by 4 corner points in 2D coordinate system. Does anyone help me with the fast (minimum trigonometry operations) algorithm to change its height by any scale factor.

A, B, C, D is known. Need to find A1, B1, C1, D1.

Why not just ($s=$ scale factor): $$A_1=s(A-D)+ D$$ $$D_1=s(D-A)+ A$$ and similarly for $B_1$ and $C_1$.

Step 1: compute a vector from, for example, $\vec{DA}$

Step 2: divide the vector by it's length (hint: pythagoras theorem) and multiply by desired height

Step 3: add the vector to A, B, and substract it from D, C

Joseph O'Rourke's answer is computationally faster !

• Thank you! Pythagoras theorem give me vector length, yea... Can you post me any example of vector operations that I need to do? What does "compute a vector from" means? – Ilya Jul 30 '15 at 23:21
• $\vec{DA}$ means $(x_1 - x_4)i + (y_1 - y_4)j$ – user256916 Jul 30 '15 at 23:22
• Thanx! What do you think about the Joseph O'Rourke's approach? – Ilya Jul 30 '15 at 23:26
• It works, use that if you can – user256916 Jul 30 '15 at 23:30