Topic: The interesting and vital task with the useful result
So useful that is quite possible, someone already solved it and laid out as function in any library. It is given: a picture of the arbitrary form on a canvas with the sizes *Y. We consider that coordinates of the left upper corner of a canvas 0,0. The task: to Find the maximum sides of a rectangle with the given ratio of the sides k, completely being in a picture. [Length of the horizontal side of a rectangle] / [length of the vertical side of a rectangle] =k. Function should return an array from three numbers: 1-2) r , r  - coordinates of the upper left corner of a rectangle on a canvas. 3) r  - length of the horizontal side of a rectangle.