本文整理汇总了Python中vector.Vector.is_orthogonal_to方法的典型用法代码示例。如果您正苦于以下问题:Python Vector.is_orthogonal_to方法的具体用法?Python Vector.is_orthogonal_to怎么用?Python Vector.is_orthogonal_to使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vector.Vector
的用法示例。
在下文中一共展示了Vector.is_orthogonal_to方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __eq__
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import is_orthogonal_to [as 别名]
def __eq__(self, line1):
if Vector(self.normal_vector).is_zero():
if not Vector(line1.normal_vector).is_zero():
return False
else:
diff = self.constant_term - line1.constant_term
return Vector(MyDecimal(diff)).is_near_zero()
elif Vector(line1.normal_vector).is_zero():
return False
if not self.is_parallel(line1):
return False
x0 = self.basepoint
y0 = line1.basepoint
basepoint_difference = Vector(x0.minus(y0))
n = Vector(self.normal_vector)
return basepoint_difference.is_orthogonal_to(n)
示例2: print
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import is_orthogonal_to [as 别名]
from vector import Vector
print('first pair...')
v = Vector([-7.579, -7.88])
w = Vector([22.737, 23.64])
print('is parallel: ', v.is_parallel_to(w))
print('is orthogonal: ', v.is_orthogonal_to(w))
print('second pair...')
v = Vector([-2.029, 9.97, 4.172])
w = Vector([-9.231, -6.639, -7.245])
print('is parallel: ', v.is_parallel_to(w))
print('is orthogonal: ', v.is_orthogonal_to(w))