Get the largest rectangle in a quadrilateral

1.3k Views Asked by At

So I have coordinates for a few shapes with 4 sides of varying angles. I need to find the largest rectangle in them, even if the rectangle is rotated. Is there an algorithm for this?

In the example image below I have the coords for the orange quadrilaterals and I'm looking for the grey rectangle inside, more specifically the coordinate for each green dot.

Any ideas or could someone point me in the right direction?

enter image description here