'The centroid of the polygon.
Returns
centroid : Point
See Also
sympy.geometry.point.Point, sympy.geometry.util.centroid
Examples
>>> from sympy import Point, Polygon
>>> p1, p2, p3, p4 = map(Point, [(0, 0), (1, 0), (5, 1), (0, 1)])
>>> poly = Polygon(p1, p2, p3, p4)
>>> poly.centroid
Point2D(31/18, 11/18)'

@property
def centroid(self):

    A = (1 / (6 * self.area))
    (cx, cy) = (0, 0)
    args = self.args
    for i in range(len(args)):
        (x1, y1) = args[(i - 1)].args
        (x2, y2) = args[i].args
        v = ((x1 * y2) - (x2 * y1))
        cx += (v * (x1 + x2))
        cy += (v * (y1 + y2))
    return Point(simplify((A * cx)), simplify((A * cy)))
