Find the sides of a rectangle if you know the sides of a quadrilateral inside the rectangle

geometrytrigonometry

I'm working on an application that uses a accelerometer to measure the sides of a room, I know it will not be exact measurements but it's fine. In reality I would like the program to be able to calculate the sides of any room shape not only rectangles and squares (and more than 4 corners), but I'm starting with something more simple (rectangle shaped rooms).

My problem is not with the accelerometer but more with the math aspect of the code. Because I measured the room by placing the phone on a wall and then going to the connected wall, I will get the measurements of a quadrilateral inside the rectangle. From there, if it's possible, I will get the measurements of the sides of the rectangle, but I don't really know how.

What I've tried so far: Divided the quadrilateral inside the rectangle in half, to make 2 triangles. Then I calculated the diagonal using the Pythagoras theorem. Then I used the law of Cosines to calculate one of the angles, and did the same again to find another. Then found the 3rd angle using the 2 other angles (c=a+b-180). I did this for both triangles.

I don't know if this is the right approach and if I have missed something simple, or if I simply don't have enough information to solve for the sides of the rectangle. I have looked into some geometry and trigonometry math online and haven't find anything that gives me a solution. But like I said, maybe I missed something simple. Any push in the right direction would be helpful.
Here is picture to help visualise:

Rectangle and quadrilateral
Note that I trying to find the lengths of the side of the rectangle, while I know the sides of the quadrilateral and the angles of the rectangle.

Best Answer

This is indeterminate. If you rotate the quadrilateral, the axis-aligned bounding box varies. enter image description here