For example , in geometry a diagonal is any line that goes between the corners of a polygon . So a square has two diagonals , and a five-sided shape has five diagonals . For any convex polygon , all the diagonals are inside the polygon , but for re-entrant polygons , some diagonals are outside of the polygon .