updated generatePolygons script.