本文整理汇总了Python中sympy.core.basic.C.acos方法的典型用法代码示例。如果您正苦于以下问题:Python C.acos方法的具体用法?Python C.acos怎么用?Python C.acos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sympy.core.basic.C
的用法示例。
在下文中一共展示了C.acos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: angle_between
# 需要导入模块: from sympy.core.basic import C [as 别名]
# 或者: from sympy.core.basic.C import acos [as 别名]
def angle_between(l1, l2):
"""
Returns an angle formed between the two linear entities.
Description of Method Used:
===========================
From the dot product of vectors v1 and v2 it is known that:
dot(v1, v2) = |v1|*|v2|*cos(A)
where A is the angle formed between the two vectors. We can
get the directional vectors of the two lines and readily
find the angle between the two using the above formula.
"""
v1 = l1.p2 - l1.p1
v2 = l2.p2 - l2.p1
return C.acos( (v1[0]*v2[0]+v1[1]*v2[1]) / (abs(v1)*abs(v2)) )