Hi all!

Since I'm mathematically challenged, could someone please help me with this?

Given a MCs size (say 360 x 240), how would I calculate the maximum size a shape inside that MC could be given the shapes aspect ratio?

In other words, given the MC dimensions above:

a 2:2 ratio would result in a 240x240 max size (within the MC).

a 9:2 ratio would result in a 360x80 max size (within the MC).

a 1.5:4 ratio would result in a 90x240 max size (within the MC).

I can do this in my head but I can't seem to write it down/ code it.

Ideally, I'd just pass the 4 vars to a function like so:

function(mc._width, mc._height, x-aspect, y-aspect)

and then output result_width and result_height

Thanks for any help!