Open In App

Python | Sympy Line.smallest_angle_between method

Last Updated : 30 Jan, 2020
Improve
Improve
Like Article
Like
Save
Share
Report
In Sympy, the function smallest_angle_between() is used to return the non-obtuse angle at the intersection of lines.

Syntax: smallest_angle_between(l2)

Parameters: 
 l1: LinearEntity
 l2: LinearEntity

Returns: angle [angle in radians]

Example #1:




# import sympy and Point, Line, pi
from sympy import Point, Line, pi
   
# using Line() method
l1 = Line((0, 0), (1, 0))
l2 = Line((1, 1), (0, 0))
   
# using smallest_angle_between() method
rad = l2.smallest_angle_between(l1)
   
print(rad)


Output:

pi/4

Example #2:




# import sympy and Point, Line, pi
from sympy import Point, Line, pi
   
# using Line() method
l1 = Line((0, 0), (1, 0))
l3 = Line((3, 1), (0, 0))
   
# using smallest_angle_between() method
rad = l3.smallest_angle_between(l1)
   
print(rad)


Output:

acos(3*sqrt(10)/10)

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads