Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+5 votes

How are we supposed to have the different images be in different ratios.

asked in old_CSC201 by (1 point)

1 Answer

0 votes

The maximum dimension will always be set to MAX_SIZE. You can determine the maximum dimension by subtracting minX from maxX to get the width of the points in the x direction. The same with the ys the get the height of the points in the y direction.

If the width is greater than the height, then we'll make the width of the GraphWin to be MAX_SIZE. The window's height will then be the height determined by the points divided by the width determined by the points times MAX_SIZE. So if the points gave a width of 500 and a height of 200, the height of the window should be 200/500 times MAX_SIZE or 2/5th of the MAX_SIZE (So if MAX_SIZE = 1000, 1000 wide and (2/5) * 1000 = 400 tall.)

Otherwise, make the height of the window, MAX_SIZE and the width a fraction of it.

answered by (1 point)