/triangulate

2d polygons triangulation with earcut algorithm

Primary LanguagePythonMIT LicenseMIT

triangulate

2d polygons triangulation with earcut algorithm

Input

csv file with polygon vertices coords in counterclock-wise ("x" first, "y" second, integers only):

1, 0
1, 1
0, 1
0, 0

Output

  1. If success, csv with triangulation:
3,0,1
1,2,3
  1. If fault, csv file with error only, for example:
ERROR: Incorrect input data

How to use

At first, do the following:

  1. clone repo
  2. move to project root folder
  3. execute following commands:
python -m venv env  # setup new virtualenv
source env/bin/activate  # activate new virtualenv
pip install -r requirements.txt  # install all project requirements
  1. to run program, just run python script with two params:
python main.py -i 'in.csv' -o 'out.csv'

Optional flags

-t - run tests, check out if block in main.py (Some autogen examples could be incorrect)

-a - draw plot to check asymptote, check out if block in main.py

TODO:

Options

-g - gui mode