📜  Python| Sympy Line.smallest_angle_between 方法

📅  最后修改于: 2022-05-13 01:55:48.015000             🧑  作者: Mango

Python| Sympy Line.smallest_angle_between 方法

在 Sympy 中,函数minimum_angle_between smallest_angle_between()用于返回直线相交处的非钝角。
Syntax: smallest_angle_between(l2)

Parameters: 
 l1: LinearEntity
 l2: LinearEntity

Returns: angle [angle in radians]

示例 #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)

输出:

pi/4

示例 #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)

输出:

acos(3*sqrt(10)/10)