Python – Sympy Polygon.distance() method Last Updated : 01 Aug, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report In Sympy, the function Polygon.distance() is used to return the shortest distance between the given polygon and o. If o is a point, then given polygon does not need to be convex. But If o is another polygon then, the given polygon and o must be convex. Syntax: Polygon.distance(o) Parameters: o:Point or Polygon Returns: the shortest distance between the given polygon and o. Example #1: Python3 # import sympy import Point, Polygon from sympy import Point, Polygon # creating points using Point() p1, p2, p3, p4 = map(Point, [(0, 2), (0, 0), (1, 0), (1, 2)]) # creating polygon using Polygon() poly = Polygon(p1, p2, p3, p4) # using distance() shortestDistance = poly.distance(Point(3, 5)) print(shortestDistance) Output: sqrt(13) Example #2: Python3 # import sympy import Point, Polygon, RegularPolygon from sympy import Point, Polygon, RegularPolygon # creating points using Point() p1, p2 = map(Point, [(0, 0), (7, 5)]) # creating polygon using Polygon() and RegularPolygon() poly = Polygon(*RegularPolygon(p1, 1, 3).vertices) # using distance() shortestDistance = poly.distance(p2) print(shortestDistance) Output: sqrt(61) Comment More infoAdvertise with us Next Article Python â Sympy Polygon.encloses_point() method R ravikishor Follow Improve Article Tags : Python SymPy Python SymPy-Geometry Practice Tags : python Similar Reads Python â Sympy Polygon.intersection() Method In Sympy, the function Polygon.intersection() is used to get the intersection of a given polygon and the given geometry entity. The geometry entity can be a point, line, polygon, or other geometric figures. The intersection may be empty if the polygon and the given geometry entity are not intersecte 2 min read 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 polygo 1 min read Python | Sympy Line.distance() method In Sympy, the function distance() is used to find the shortest distance between a given line and a given point. Syntax: Line.distance(other) Parameter: other: a point Returns: shortest distance between a line and a point Raises: NotImplementedError is raised if `other` is not a Point Example #1: Pyt 1 min read Python â Sympy Polygon.encloses_point() method In Sympy, the function Polygon.encloses_point() is used to check whether the given point is enclosed by polygon or not. It returns True if the given point lies inside of the polygon, otherwise False. Being on the border of the polygon is also considered False. Syntax: Polygon.encloses_point(p) Param 1 min read Python â Sympy Polygon.cut_section() Method In Sympy, the function Polygon.cut_section() is used to get a tuple of two polygon segments(two-part of the polygon) that lie above and below the intersecting line respectively. It simply returns the two parts of the polygon intersected by the line. Returns None when no polygon exists above the line 2 min read Python | sympy.combinatoric.Polyhedron() method With the help of sympy.combinatoric.Polyhedron() method, we can get the value of polyhedron by passing list of characters in it by using sympy.combinatoric.Polyhedron() method. Syntax: sympy.combinatoric.Polyhedron()Return: Return the value of polyhedron. Example #1: In this example, we can see that 1 min read Like