本文整理汇总了Python中vector.Vector.angle_with方法的典型用法代码示例。如果您正苦于以下问题:Python Vector.angle_with方法的具体用法?Python Vector.angle_with怎么用?Python Vector.angle_with使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vector.Vector
的用法示例。
在下文中一共展示了Vector.angle_with方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Vector
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import angle_with [as 别名]
from vector import Vector
v = Vector([7.887, 4.138])
w = Vector([-8.802, 6.776])
print(v.dot(w))
v = Vector([3.183, -7.627])
w = Vector([-2.668, 5.319])
print(v.angle_with(w))
v = Vector([7.35, 0.221, 5.188])
w = Vector([2.751, 8.259, 3.985])
print(v.angle_with(w, in_degrees=True))
示例2: Vector
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import angle_with [as 别名]
print ''
print 'Dot Product'
v1 = Vector([7.887, 4.138])
v2 = Vector([-8.802, 6.776])
print v1.dot_product(v2)
v1 = Vector([-5.955, -4.904, -1.874])
v2 = Vector([-4.496, -8.755, 7.103])
print v1.dot_product(v2)
# Angles
v1 = Vector([3.183, -7.627])
v2 = Vector([-2.668, 5.319])
print ''
print 'Angle Radians'
print v1.angle_radians(v2)
print v1.angle_with(v2, False)
v1 = Vector([7.35, 0.221, 5.188])
v2 = Vector([2.751, 8.259, 3.985])
print ''
print 'Angle Degrees'
print v1.angle_degrees(v2)
print v1.angle_with(v2, True)
# Parallel & Orthogonal
print ''
print 'Parallel & Orthogonal'
v1 = Vector([-7.579, -7.88])
v2 = Vector([22.737, 23.64])
print v1
print v2
print 'Parallel: {}'.format(v1.parallel_with(v2))