Calculating areas and perimeters of polygons in the coordinate system