Detecting polygons