Friday, October 10, 2025
HomeLanguagesPython – Sympy Polygon.is_convex() Method

Python – Sympy Polygon.is_convex() Method

In Sympy, the function Polygon.is_convex() is used to check whether the given polygon is convex or not. A polygon is said to be convex if all its interior angles are less than 180 degrees and there are no intersections between the sides.

Syntax: Polygon.is_convex()

Returns:
 True: True if this polygon is convex, False otherwise.

Example #1:

Python3




# import Point, Polygon
from sympy import Point, Polygon
  
# creating points using Point()
p1, p2, p3, p4 = map(Point, [(0, 0), (1, 0), (5, 1), (0, 1)])
  
# creating polygon using Polygon()
isConvex = Polygon(p1, p2, p3, p4)
  
# using is_convex()
print(isConvex.is_convex())


Output:

True

Example #2:

Python3




# import Point, Polygon
from sympy import Point, Polygon
  
# creating points using Point()
p1, p2, p3, p4, p5 = map(Point, [(0, 0), (3, 2), (4, 5), (7, 1), (6, 3)])
  
# creating polygon using Polygon()
isConvex = Polygon(p1, p2, p3, p4, p5)
  
# using is_convex()
print(isConvex.is_convex())


Output:

False
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32350 POSTS0 COMMENTS
Milvus
87 POSTS0 COMMENTS
Nango Kala
6718 POSTS0 COMMENTS
Nicole Veronica
11880 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11941 POSTS0 COMMENTS
Shaida Kate Naidoo
6838 POSTS0 COMMENTS
Ted Musemwa
7101 POSTS0 COMMENTS
Thapelo Manthata
6794 POSTS0 COMMENTS
Umr Jansen
6794 POSTS0 COMMENTS