本文整理汇总了Python中vector.Vector.is_cclockwise方法的典型用法代码示例。如果您正苦于以下问题:Python Vector.is_cclockwise方法的具体用法?Python Vector.is_cclockwise怎么用?Python Vector.is_cclockwise使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vector.Vector
的用法示例。
在下文中一共展示了Vector.is_cclockwise方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_cclockise
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import is_cclockwise [as 别名]
def test_cclockise(self):
start = Vertex(2,1)
base_vector = Vector(start, Vertex(3,1))
cclockwise = ((1,0),(2,0),(3,0))
not_cclockwise = ((1,1),(3,2),(2,2),(1,2),(3,1))
self.assertListEqual([base_vector.is_cclockwise(Vector(start, Vertex(v[0],v[1]))) for v in cclockwise], [True for x in range(len(cclockwise))])
self.assertListEqual([base_vector.is_cclockwise(Vector(start, Vertex(v[0],v[1]))) for v in not_cclockwise], [False for x in range(len(not_cclockwise))])
示例2: right_iter
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import is_cclockwise [as 别名]
def right_iter(self, around, left):
base_vec = Vector(around, left)
start_index, i, max_cos = None, 0, -2
edges = []
for edge in filter(lambda x: base_vec.is_cclockwise(x), self.vertices[around]):
edges.append(edge)
angle_cos = base_vec.cos_angle(edge)
if angle_cos > max_cos:
start_index, max_cos = i, angle_cos
i = i + 1
i, start_index = start_index, start_index - len(edges)
while ( start_index < i):
yield edges[i].end
i = i - 1