def center (self):
    """center() -> (x, y)

    Returns the center (of mass) point of this Polygon.

    See http://en.wikipedia.org/wiki/Polygon

    Examples:

    >>> p = Polygon()
    >>> p.vertices = [ Point(3, 8), Point(6, 4), Point(0, 3) ]
    >>> p.center()
    Point(2.89285714286, 4.82142857143)
    """
    Cx    = 0.0
    Cy    = 0.0
    denom = 6.0 * self.area()

    for segment in self.segments():
      x   = (segment.p.x + segment.q.x)
      y   = (segment.p.y + segment.q.y)
      xy  = (segment.p.x * segment.q.y) - (segment.q.x * segment.p.y)
      Cx += (x * xy)
      Cy += (y * xy)

    Cx /= denom
    Cy /= denom

    return Point(Cx, Cy)
def center ( self ) : Cx = 0.0 Cy = 0.0 denom = 6.0 * self . area ( ) for segment in self . segments ( ) : x = ( segment . p . x + segment . q . x ) y = ( segment . p . y + segment . q . y ) xy = ( segment . p . x * segment . q . y ) - ( segment . q . x * segment . p . y ) Cx += ( x * xy ) Cy += ( y * xy ) Cx /= denom Cy /= denom return Point ( Cx , Cy )
center() -> (x, y)

    Returns the center (of mass) point of this Polygon.

    See http://en.wikipedia.org/wiki/Polygon

    Examples:

    >>> p = Polygon()
    >>> p.vertices = [ Point(3, 8), Point(6, 4), Point(0, 3) ]
    >>> p.center()
    Point(2.89285714286, 4.82142857143)