Algorithm containsPolygon