detecting polygons