title: Intersect n line segments (on integer grid)
body: <p>I have a problem that looks almost like a classic CS problem of finding all intersection points of given line segments.  </p>
  
  <p>The slight modification is the fact that:<br>
  1. I need to split all the segments at their intersection points<br>
  2. The resulting split segments must have integer coordinates.  </p>
  
  <p>If I just apply standard sweepline algorithm to find all the intersection points, and than cast coordinates of these points to integers, I sometimes get new intersections caused by the moving of intersections points to the integer grid.</p>
  
  <p>I may apply this algorithm repeatedly, and probably (I can't prove it), in limited number of steps reach a state where I find no new intersections.
  But I'm convinced there must be a simpler, more elegant solution.</p>
  
  <p>I was trying to find a paper about such algorithm, but somehow couldn't find one that would deal with exactly this problem. </p>
  
  <p>Can you tell point me to such a pape, or a description of an algorithm used by graphics libraries (such as Boost Polygon Library)?</p>
  
  <p>Thank you.</p>