Calculate new X & Y coordinate based on compressed or enlarged rectangle

19 Views Asked by At

I have two Rectangles as Rect1

    ___________ x'', y''
   |     |dy   |
   |     .x',y'|
   |           |
   |           |
0,0-------------

Here the value of x'' & y'' can vary from being smaller or larger than Rect2 Then there is fixed Rect2

    ___________ x, y
   |           |
   |     .x',y'|
   |     |dy'  |
   |     |     |
0,0-------------

How to calculate dy' distance based on value of other coordinatates that includes (x'',y'',x',y',dy) & (x,y)

Please forgive if you find wrong presentation of the question detail