title: How to find regions inside a rectangle which is crossed by multiple lines?
body: <p>Imagine you have a number of lines (each one represented by two points). Also you have a rectangle of a specific size and you know coordinates of its upper left corner. Now you have to identify which of these lines intersect with rectangle and for all those that do - find regions created inside the rectangle by the lines and calculate areas of those regions.</p>
  
  <p><img src="https://i.stack.imgur.com/P7nwH.png" alt="enter image description here"></p>