title: Determine whether one polygon contains another
body: <p>(For my purposes "polygons" do not included self-intersecting polygons or polygons with holes - just simple (concave or convex) polygons.)</p>
  
  <p>I have found various suggestions for this problem, which are mainly based around the following:</p>
  
  <blockquote>
    <p>If there are no intersections between the edges of Polygon1 and the edges of Polygon2, and at least one vertex of Polygon2 is "inside" Polygon1, then Polygon1 contains Polygon2.</p>
  </blockquote>
  
  <p>(eg see the accepted answer <a href="https://stackoverflow.com/questions/4833802/check-if-polygon-is-inside-a-polygon">here</a>)</p>
  
  <p>However, the devil is in the detail:</p>
  
  <ul>
  <li><p>Does "inside" Polygon1 include "on an edge of" Polygon1? Clearly it
  must, otherwise in diagram F (see the image linked below) Polygon2 (red) would have no
  vertex "inside" Polygon1 (blue) and so fail the above test, when
  it should pass.</p></li>
  <li><p>Does an "intersection" of two edges include a point at the end of one
  of the edges (ie a vertex)?  If "yes", then diagrams A and E below
  have intersections and so fail the test when they should pass.  But
  if "no", then diagrams B, C and D have no intersections and so pass
  the test when they should fail.</p></li>
  </ul>
  
  <p><img src="https://i.stack.imgur.com/q1AiM.png" alt="Selection of diagrams to illustrate the above."> (NB diagrams A, B and C have vertices of Polygon2 on edges of Polygon1, diagrams D and E vice versa.)</p>
  
  <p>I can't work out a condition to test which distinguishes correctly between these various cases. I'd be grateful for any pointers? </p>