title: Find the boundary of a polygon (or a staircase) c++
body: <p>I'm doing an 2D bin packing algorithm. The goal is to put a set of rectangle into a bin one by one.</p>
  
  <p>At each rectangle insertion, i want to update the boundary between occupied area and free area. Thus, i'm looking for an algorithm or the way to do it. Algorithm must be able to:</p>
  
  <p>1) Find the boundary after rectangle insertion (or find all points of the boundary).</p>
  
  <p>2) Travel clockwise all the points of the boundary (imagine that now I have all points coordinates of the boundary).</p>
  
  <p>3) At each corner (point) of the boundary, the algorithm can determinate if this point is on the top left, top right, bottom left, bottom right</p>
  
  <p>Any help would be greatly appreciated. If you need more information, just ask and I'll provide all I can.</p>
  
  <p>Thank you</p>