title: How can I inscribe a rectangle or circle inside an arbitrary quadrilateral
body: <p>This may be a more math focused question, but wanted to ask here because it is in a CS context.  I'm looking to inscribe a rectangle inside another (arbitrary) quad with the inscribed quad having the largest height and width possible.  Since I think the algorithm will be similar, I'm looking to see if I can do this with a circle as well.</p>
  
  <p>To be more clear hear is what I mean by the bounding quadrilateral as an example.
  <img src="https://i.stack.imgur.com/sUgyP.png" alt="enter image description here"></p>
  
  <p>Here are 2 examples of the inscribed maximization I'm trying to achieve:
  <img src="https://i.stack.imgur.com/tecvm.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/OLNmS.png" alt="enter image description here"></p>
  
  <p>I have done some preliminary searching but have not found anything definitive.  It seems that some form of dynamic programming could be the solution.  It seems that this should be a linear optimization problem that should be more common than I have found, and perhaps I'm searching for the wrong terms.</p>
  
  <p><strong>Notes:</strong>  For the inscribed square assume that we know a target w/h ratio we are looking for (e.g. 4:3).  For the quad, assume that the sides will not cross and that it will be concave (if that simplifies the calculation).</p>