'Returns the shortest distance between self and o.
If o is a point, then self does not need to be convex.
If o is another polygon self and o must be complex.
Examples
>>> from sympy import Point, Polygon, RegularPolygon
>>> p1, p2 = map(Point, [(0, 0), (7, 5)])
>>> poly = Polygon(*RegularPolygon(p1, 1, 3).vertices)
>>> poly.distance(p2)
sqrt(61)'

def distance(self, o):

    if isinstance(o, Point):
        dist = oo
        for side in self.sides:
            current = side.distance(o)
            if (current == 0):
                return S.Zero
            elif (current < dist):
                dist = current
        return dist
    elif (isinstance(o, Polygon) and self.is_convex() and o.is_convex()):
        return self._do_poly_distance(o)
    raise NotImplementedError()
