Please, read the following medium article to learn more about the implemented partitioning algorithm.
Install tkinter
sudo apt-get install python3-tk
- Clone the repo
git clone https://github.com/mdiamantino/optimal-region-partitioning-convex-polygons-python.git
- Enter the cloned directory and create a virtual environment
cd optimal-region-partitioning-convex-polygons-python/
python3 -m venv venv
- Activate the virtual environment
. venv/bin/activate
- Install requirements
pip3 install -r requirements.txt
-
Run demo.py to execute the partitioning of [(98, 136), (179, 323), (321, 313), (493, 142), (506, 23), (98, 58)] into 5 sub-regions.
python3 demo.py
-
Or, use your own polygon's coordinates and number of partitions (with graphical visualization):
python3 main.py
-
Or, use the project as module (without graphical visualization):
python3
>>> from partitioner import compute_partitions_recursive
- compute_partitions_recursive(YOUR COORDINATES HERE, YOUR NUMBER OF PARTITIONS HERE) Example:
>>> compute_partitions_recursive([(0,0),(0,5),(7,7),(4,0)],3)
Mark Diamantino Caribé - Mark.Diamantinocaribe@student.kulevuen.be - LinkedIn
Project Link: https://github.com/mdiamantino/optimal-region-partitioning-convex-polygons-python