I would like to obtain a graph of the potential energy of a polygon under rotation, given that it is proportional to the vertical distance from the centroid to the "floor". I have made the following attempts: given the polygon

i have obtained the graph below

(ignore the bottom part and the angles). Of course, I should expect a continuous curve, but I'm not getting one... I've obtained this curve using calculations. Any help?
