need equations for a rectangle in a rectangle

chibois

New member
Joined
Nov 11, 2010
Messages
1
math.png

these are 2 rectangles (90 degree angles)
x<3y<9x

i'm trying to write a program where u input an image, it rotates a logo and expands it to cover the image, i need an equation for the degrees "r" and the height "a" given x and y as inputs. its been 6 years since i've taken geometry and trig and i'm quite stumped as to how to make the equations.

thanks in advance!
 
The smaller and larger right triangles are similar, which "sweetens the deal"!
Without going into details (hate typing):

u = (3x - y) / 8
v = (3y - x) / 8

a = SQRT(u^2 + v^2) : in other words, a is length of the hypotenuse of right triangle with legs = u and v

r = ASIN(u / a)

Try it; let x=39 and y=53
You'll get u=8, v=15, a=17 and r = ~28.072 degrees
The larger right triangle becomes: 24-45-51 (what does that tell you?)
 
Top