mergePolygons: generating merged vertices struct working except some weird corner cases