This problem is different from testing if one rect is in another rect.
Known information is the sides length of two rects.
How to calculate if one rect can be pu
Well, it looks like A.R.S. solution is true, still I'll try to post my solution, it's harder, but it'll let you to build a concrete embedding of one rectangle into another (if possible).
Let us suppose that and All you need is to make sure that last system of inequalities has a solution lying between a>b
and p > q
. Solution is obvious if a > p
and b > q
. The problem can also be solved if a
b>q
. Take a look at the attached photo, in it you'll need only last system of inequalities (if you interested you can look how it was derived)0
and 1
. To do it you need to solve each inequality as equation (as usual quadratic equation). If there are no solution (that's improbable) the solution of inequality is whole real line. If equation has two (maybe equal) solutions t_1
and t_2
the solution of inequality is segment [-infinity, t_1]
united with [t_2, infinity]
. After you got solutions of both inequalities you should intersect them. Now we should recollect that t
is cos
of an angle (between 0
and pi/2
), so inequality should have solutions between 0
and 1
. In that case second rectangle can be embedded into first one. And if you take e.g. t_1
(smaller root of equations) you can build a concreate embedding of rectangles.