An adaptive numerical integration algorithm for polygons