For some reason this problem which seemed fairly easy on the surface has given me a lot of trouble. I have a square who's side length changes based on an independent variable. The square's upper left corner is at the origin, and the square's lower right corner is at $(l_f,-l_f)$, where $l_f$ is the length of the square.
Our rectangle must always have a width to heigth ratio of $1280/720$. When the square is at it's initial length, the length of the square and the height of the rectangle should be the same. Additionally, the square must always be directly in the middle of the rectangle (that is, the center of the square and the center of the rectangle coincide). And finally, the ratio of the square's length and the rectangles lengths must get linearly smaller as the square's length decreases, and linearly larger as the square's length increases. I need the equations for $(x_i,y_i)$ and $(x_f,y_f)$, where $x_i$ and $y_i$ are the coordinates of the top left corner of the rectangle, and $x_f,y_f$ are the coordinates of the bottom right corner of the rectangle, based on the following variables.
$d = $ an independent variable, in the domain $(0, \infty)$, initial value of $1$
$l_i = $ constant (initial size of square...for my problem it is 250)
$l_f = l_i\cdot d \rightarrow$ (where $l_f$ is the length of the square)
My Attempt
I believe my attempt at getting the y limits is correct. $$y_i = \frac{l_f}{2} - \frac{l_i}{2}$$ $$y_f = \frac{l_f}{2} + \frac{l_i}{2}$$
The $x$ coordinates are the hard ones now. Because the initial height of the rectangle and the length of the square must be the same, we need a corrective term to add onto the $x$ coordinates. The following term worked (not sure if it's neccessary in the end though). $\frac{1}{2} \cdot l_f(\frac{1280}{720} - 1)$. Then, if the independent variable changes from it's default value of 1, we need another term since the width and height of the rectangle can't continue to scale at the same rate, otherwise the 1280x720 ratio is not maintained. I thought this term would do the trick $\frac{1280}{720}(\frac{l_f}{2} - \frac{l_i}{2})$, but using these terms does not give me the correct answer. Using these terms, I get the following:
$$x_i = \left(1 + \frac{1280}{720}\right) \left(\frac{l_f}{2} - \frac{l_i}{2}\right) - \frac{1}{2} \cdot l_f\left(\frac{1280}{720} - 1\right)$$ $$x_f = \left(\frac{l_f}{2} + \frac{l_i}{2}\right) - \frac{1}{2} \cdot l_f\left(\frac{1280}{720} - 1\right) - \frac{1280}{720} \left(\frac{l_f}{2} - \frac{l_i}{2}\right)$$
Like I said this doesn't work though. Let me know if you have any tips, thanks!
If I'm understanding everything correctly, here's what I think you're looking for: \begin{align*} y_i &= \dfrac{-l_i}{2} - \dfrac{l_f}{2} \\ y_f &= \dfrac{-l_i}{2} + \dfrac{l_f}{2} \\ x_i &= \dfrac{l_i}{2} - \dfrac{\frac{1280}{720}l_f}{2} \\ x_f &= \dfrac{l_i}{2} + \dfrac{\frac{1280}{720}l_f}{2} \\ \end{align*} Here's what I did. Initially, the centre of the square/rectangle is at $(l_i/2, -l_i/2)$. Note that linearly scaling the square/rectangle by a factor of $d$ will not change this centre point. Now to get the corners, we simply have to either add or subtract half the dimensions of the rectangle. Initially, the rectangle has a height of $l_i$, so scaling it by $d$ gives us a new height of $l_f$. Since we know the aspect ratio, it follows that the new width must be $\frac{1280}{720}l_f$.