Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Daryl
Posts:
2
Registered:
2/16/12


Ratio of square sizes
Posted:
Feb 16, 2012 3:49 PM


So I'm out of my league on this math problem. I'll try to explain as simply as possible. Any help would be awesome. This is a piece of Javascript I am writing but the math is my issue.
I have a template that is built on a 4200 x 4200 square. That template draws squares based on coordinates contained within that template. {L,T,R,B} The template can be applied to any document size {activeDocument}. If that document size is not square, my ratios are off.
Here are my formulas.
wd = width of template hd = height of template
maxWidth = (activeDocument.width)/2; //width of active document divided in half maxHeight = activeDocument.height; //height of active document
ratioRec = wd/hd; //aspect ratio of template ratioView = maxWidth/maxHeight; //aspect ratio of document
ratio = ratioView/ratioRec; ratioW = maxWidth/wd; ratioT = (maxHeight/hd);
//Sizing variables, this is where the problem is left = (left * ratioW); right = (right * ratioW) ; top = (top * ratioT); bottom = (bottom * ratioT) ;
Thanks for any help you might have on this. If something is not clear or need more information, please let me know.
Thanks



