title: Polyline offset with closed polygon and islands
body: <p>I have unsorted set of line segments without any binding to each other. Each line described with 2 points (x,y). I can search for lines with the same points, which means they should be connected.</p>
  
  <p>Every line have a thickness attribute.  I need to offset each path by this thickness, and create 4 points describing the final plygon (for each line).</p>
  
  <p><a href="https://sites.google.com/site/dusanmaliarik/screenshot1.png" rel="nofollow noreferrer">Screenshot 1</a></p>
  
  <p>now I need to refine it to handle corners (joins) correctly. but have no idea how to do it.</p>
  
  <p>Desired result: <a href="https://sites.google.com/site/dusanmaliarik/screenshot2.png" rel="nofollow noreferrer">Screenshot 2</a></p>