title: Polygon Detection from a Set of Lines?
body: <p>I have a set of connected, intersecting line segments. I want to detect all polygons that result from the intersection of these line segments, as follows:</p>
  
  <p><img src="https://i.imgur.com/9OBXSTJ.jpg" alt="Picture"></p>
  
  <p>I found a paper that presents an algorithm for solving this problem, but I'm not really a computer science person so I wasn't able to understand it. Here's a link to the <a href="http://web.ist.utl.pt/alfredo.ferreira/publications/12EPCG-PolygonDetection.pdf" rel="nofollow noreferrer">paper</a>. At this moment, my plan is to 1) find all intersections, and 2) somehow use these intersections to identify the polygons. I'm able to solve (1) through brute force, but (2) is a bit trickier. I'd prefer a solution in R or C++, but any language will do.</p>