How to determine width and height of outer rectangle when it is scalled to an inner rectangle

by Diego Alves   Last Updated September 13, 2017 14:20 PM

I have a rectangle with more than 800 width and 600 height. It can be 1000 x 600, 2000 x 1000 and etc. I want to scale it to 800 x 600. I want to determine which one matches first, the height or the width and also get the other value that didn't meet first.

|                |
|  |800x600   |  |
|  |inners rec|  |
|                |outer rectangle(1000 x 1000) if I resize which one will hit the boundaries of the inner rectangle left and right or top and bottom.


Answers 1


Take the ratio in each axis and use the smaller one. So if you start with $2000 \times 1000$ the horizontal is $\frac {800}{2000}=0.4$, the vertial is $\frac {600}{1000}=0.6$. So you scale by a factor $0.4$ and the vertical is $0.4 \cdot 1000=400$. These are rectangles, not squares.

Ross Millikan
Ross Millikan
September 13, 2017 14:06 PM

Related Questions


How to define a plane based on 4 points

Updated March 09, 2017 03:20 AM

Does harmonic decomposition preserve immersions?

Updated April 05, 2016 08:08 AM

The cohomology of the Dirac operator $d+d^{*}$

Updated February 23, 2016 04:08 AM