Link to home
Start Free TrialLog in
Avatar of cjm20
cjm20Flag for United States of America

asked on

Incorporating window aspect ratio into drawing window

I have a window in my C++ app that I use to draw something.  I'll call this "something" a "model".  My window is NOT a perfect square.  It is wider than it is taller.  It's about 4 times wider than it is tall.  I am having trouble wrapping my brain around how to set the window dimensions, such that the model I draw within the window will be scaled correctly.  

If the model I want to draw is taller than it is wide, this is easy to draw.  I just make the window dimensions in the vertical direction equal to the model's height.  Then, I make the window's horizontal dimensions be equal to the model's height times 4 (because the window's aspect ratio is 4). This works fine.

But, if the model I want to draw is wider than it is taller, I am having difficulty.  I could just make the window's vertical dimension be equal to the model's horizontal dimension, and make the window's horizontal dimension be equal to the model's horizontal dimension times 4.  This scales my model wit proper proportion.  However, it makes my model draw too small, because the window's dimensions are much bigger than they need to be.

Any help would be greatly appreciated.
ASKER CERTIFIED SOLUTION
Avatar of Member_2_5069294
Member_2_5069294

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Or perhaps you need to be able to scroll.....
Avatar of cjm20

ASKER

Excellent.  Thanks very much.