Compute diagonals for polygons