Find longer side of a rectangle with respect to another rectangle

95 Views Asked by At

So I have two rectangles:

Rectangle R1 with width r1w and height r1h
Rectangle R2 with width r2w and height r2h

I can find the slope/aspect ratio of the two rectangles using:

r1Slope = r1h/r1w
r2Slope = r2h/r2w

Now what I want is this: ONLY using the r1Slope and r2Slope values I want to see which is the longer side in R1 with respect to R2.

Example, Lets say:

R1 Width  (r1w) = 2000
R1 Height (r1h) = 1000

R2 Width  (r2w) = 400
R2 Height (r2h) = 150

I also can calculate the slopes as:

r1Slope = (1000/2000) = 0.5
r2Slope = (150/400) = 0.38

So is there a way I can formalize a comparison/calculation on r1Slope and r2Slope in order to find whether it is r1w or r1h that is the longer side? (I think in this case it is r1h)

As you might have deduced math really is not my forte, so I am hoping someone will advise me in the right direction. Thanks!

1

There are 1 best solutions below

0
On

If you meant to compare $\frac{r1h}{r2h}$ and $\frac{r1w}{r2w}$, then it is correct. Because whether $\frac{r1h}{r2h}>\frac{r1w}{r2w}$ is equivalent to whether $\frac{r1h}{r1w}>\frac{r2h}{r2w}$ which is the comparison between your slopes.