Everything I have found on google/se has been about finding a maximum area rectangle, regardless of aspect ratio.
I am trying to inscribe a rectangle inside of a right triangle. I do not know the width or height of the rectangle, but I know the aspect ratio.
My hunch is that I need to find where w^2 + h^2 of my rectangle match the distance from the corner to the hypotenuse of my bounding triangle. Unfortunately I have forgotten a majority of the geometry I took in high school and can't figure out how I would do this, and my efforts to find a solution on Google have yielded mostly just maximum-area solutions without the fixed aspect-ratio constraint I have.
I have posted a related question on SO that goes in to more detail of what I am trying to do: https://stackoverflow.com/questions/33509077/dynamic-resize-image-to-different-sizes-with-paperclip-based-on-aspect-ratio