Saturday, November 16, 2024
Google search engine
HomeLanguagesPython | Sympy Line.smallest_angle_between method

Python | Sympy Line.smallest_angle_between method

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)

Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments