'Is the polygon convex?
A polygon is convex if all its interior angles are less than 180
degrees.
Returns
is_convex : boolean
True if this polygon is convex, False otherwise.
See Also
sympy.geometry.util.convex_hull
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.is_convex()
True'

def is_convex(self):

    args = self.vertices
    cw = self._isright(args[(-2)], args[(-1)], args[0])
    for i in range(1, len(args)):
        if (cw ^ self._isright(args[(i - 2)], args[(i - 1)], args[i])):
            return False
    return True
