Fix polygon to take into account the y coordinate

Previously, the x center was used for both y and x coordinate calculations