lucadiliello / sweep-line-algorithm-python

Python2 Implementation of the Sweep Line Algorithm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sweep-line-algorithm-python

A Python implementation of the Sweep Line Algorithm. The algorithm works fine if no segment is perfectly vertical, otherwise the number of intersections found could be different from the real result. However, in most cases it seems to work fine even with vertical segments.

It uses a custom version of a PriorityQueue (to store the events) and a custom version of a TreeSet (to store the state segments).

Launch:

python2 example.py

and enjoy!

About

Python2 Implementation of the Sweep Line Algorithm


Languages

Language:Python 100.0%