本文整理汇总了Python中vector.Vector.is_orthogonal方法的典型用法代码示例。如果您正苦于以下问题:Python Vector.is_orthogonal方法的具体用法?Python Vector.is_orthogonal怎么用?Python Vector.is_orthogonal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vector.Vector
的用法示例。
在下文中一共展示了Vector.is_orthogonal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_parallel_or_orthogonal
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import is_orthogonal [as 别名]
def test_parallel_or_orthogonal():
"""Quiz 4 checking for parallelism and orthogonality"""
vector1 = Vector([-7.579, -7.88])
vector2 = Vector([22.737, 23.64])
assert vector1.is_parallel(vector2) is True
assert vector1.is_orthogonal(vector2) is False
vector3 = Vector([-2.029, 9.97, 4.172])
vector4 = Vector([-9.231, -6.639, -7.245])
assert vector3.is_parallel(vector4) is False
assert vector3.is_orthogonal(vector4) is False
vector5 = Vector([-2.328, -7.284, -1.214])
vector6 = Vector([-1.821, 1.072, -2.94])
assert vector5.is_parallel(vector6) is False
assert vector5.is_orthogonal(vector6) is True
vector7 = Vector([2.118, 4.827])
vector8 = Vector([0, 0])
assert vector7.is_parallel(vector8) is True
assert vector7.is_orthogonal(vector8) is True
示例2: is_coincidence
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import is_orthogonal [as 别名]
def is_coincidence(self, line):
"""
Determine if two Lines are coincidence Lines
Where a new line with any point from each is also parallel
To both lines
"""
if self.is_parallel(line) is False:
return False
# get a vector as the difference between to different points on
# both lines
vector = Vector(self.point_for_x(1)) - Vector(line.point_for_x(2))
# this vector should be orthogonal to the normal vector of both lines
orthogonal1 = vector.is_orthogonal(self.normal_vector)
orthogonal2 = vector.is_orthogonal(line.normal_vector)
return orthogonal1 and orthogonal2
示例3: test_is_orthogonal
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import is_orthogonal [as 别名]
def test_is_orthogonal():
v1 = Vector(-2.328, -7.284, -1.214)
v2 = Vector(-1.821, 1.072, -2.94)
assert v1.is_orthogonal(v2)