Python | Sympy Line.distance() method Last Updated : 28 Apr, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report 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: Python3 1== # import sympy and Point, Line from sympy import Point, Line p1, p2 = Point(0, 0), Point(1, 1) s = Line(p1, p2) # using distance() method shortestDistance = s.distance(Point(-1, 1)) print(shortestDistance) Output: sqrt(2) Example #2: Python3 1== # import sympy and Point, Line from sympy import Point, Line p1, p2 = Point(0, 0, 0), Point(1, 1, 1) s = Line(p1, p2) # using distance() method shortestDistance = s.distance(Point(-1, 1, 1)) print(shortestDistance) Output: 2*sqrt(6)/3 Comment More infoAdvertise with us Next Article Python | Sympy Line.distance() method R ravikishor Follow Improve Article Tags : Python SymPy Python SymPy-Geometry Practice Tags : python Similar Reads Python | Sympy Line.intersection() method In Sympy, the function intersection() is used to find the intersection with another geometrical entity. Syntax: Line.intersection(o) Parameters: o: Point or LinearEntity Returns: intersection: list of geometrical entities Example #1: Python3 1== # import sympy and Point, Line from sympy import Point 1 min read Python | Sympy Line.are_concurrent method In Sympy, the function are_concurrent() is used to check whether the given linear entities(lines) are concurrent or not. Two or more linear entities are concurrent if they all intersect at a single point. Syntax: Line.are_concurrent(lines) Parameters: lines: a sequence of linear entities. Returns: T 1 min read Python â Sympy Polygon.distance() method 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 1 min read Python | Sympy Line.parallel_line method In Sympy, the function parallel_line() is used to create a new Line parallel to the given linear entity which passes through the given point p. Syntax: Line.parallel_line(p) Parameters: p: Point Returns: Line Example #1: Python3 # import sympy and Point, Line from sympy import Point, Line p1, p2, p3 1 min read Python | Sympy Line.angle_between method In Sympy, the function angle_between() is used to return the non-reflex angle formed by rays emanating from the origin with directions the same as the direction vectors of the linear entities. Syntax: Line.angle_between(l2) Parameters: l1: LinearEntity l2: LinearEntity Returns: angle: angle in radia 1 min read Like