2 rectangles and 1 square

521 Views Asked by At

I need a solution in algebraic form. I have $2$ rectangles and $1$ square. $2$ rectangles are place vertically to each other and horizontally in front of the square. I need to scale them in a way that

  1. All interim space between rectangles and squares is occupied
  2. Square should not lose its aspect ratio(means it should remain square)
  3. $2$ of the rectangles also retain their aspect ratios
  4. However the height can be increased for both rectangles and square but they should aligned from top and bottom.

I have a rough design enter image description here

3

There are 3 best solutions below

0
On

Okay.

Rectangle 1: is $a \times b$

Rectangle 2: is $c \times d$

And square 3: is $e\times e$.

So .... scale:

Keep triangle 1: to be $a \times b$

Scale rectangle 2': so that the width $c$ scales to $a$. That is scale by $\frac ac$. So rectangle is $a \times d*\frac ac$ or $a \times \frac {da}c$

And the side of the square: The heights of the rectangles are $b$ and $\frac {da}c$. So the side of the square needs to be $b+\frac {da}c$..... so make it $b+\frac {da}c$.

0
On

This requires the solution of two linear equations in two variables.

  1. Rectangle 1: width $w$, height $h$
  2. Rectangle 2: width $W$, height $H$
  3. Square: side $S$

One wishes to scale the two rectangles by factors $x$ and $y$ such that

  1. $wx=Wy$
  2. $hx+Hy=S$

So solve

\begin{eqnarray} wx-Wy&=&0\\ hx+Hy&=&S \end{eqnarray} for $x$ and $y$

This is easily solved to give

$$x=\frac{WS}{wH+Wh}\qquad y=\frac{wS}{wH+Wh}$$

The entire result can then be scaled further by any factor required.

0
On

Save yourself the trouble of dealing with fractions until the end.

Suppose you have rectangles with (width-by-height) dimensions $a\times b$ and $c\times d$.

enter image description here

Get a common width by scaling the first rectangle with a scale factor equal to the full width ($c$) of the second, and then scaling the second rectangle with a scale factor equal to the full width ($a$) of the first.

enter image description here

The resulting rectangles have a combined height of $ad+bc$, which becomes the required side-length for your square.

From here, you can scale the entire figure however you like. In particular,

  • If you are trying to hit a target width of $w$, scale by $$\frac{w}{ad+bc+ac} \qquad\left(=\frac{\text{target width}}{\text{total width}} \right)$$
  • If you are trying to hit a target height of $h$, scale by $$\frac{h}{ad+bc} \qquad\left(=\frac{\text{target height}}{\text{total height}}\right)$$