How would i calculate the scale between two rectangles?
e.g. I have the following
Grid layout
what will the height be of the rectangle at index 8 given 2 is 4 and 15 is 5
what would i need to do to calculate the ?
Assuming the height increases linearly with the index, you get the equation of a straight line. I.e. you have the two points $(i_1, h_1) = (2,2)$ and $(i_2, h_2) = (15,5)$ and the straight line between them gives the equation $$\frac{h_2-h_1}{i_2-i_1}=\frac{h-h_1}{i-i_1}$$
Inserting the values and rearranging gives $$h=\frac{3i+20}{13}$$
At $i=8$ we then get $$h=\frac{44}{13}$$