calculating pi using polygons