polygon drawer implementation (processing.py)

polygon drawer implementation (processing.py)

if ever you wanted to implement a polygon drawer, here it is :

explanations

 

 

first we added some coordinates as 2d arrays

 

 

then for each coordinate we drew a line from it to the next, the try pass is a bad and lazy practise to prevent out of index error. the proper way is to add an if

 

 

then after the try catch we drew a line from the first coordinate to the last coordinate

 

 

then upon mouse press, we added a new coord to the array

  •  
  •  
  •  
  •  

Lives in Mauritius, cruising python waters for now.