added sweep line algorithm; has still some bugs