本文整理匯總了Python中algorithm.Algorithm.polar_angle_sort方法的典型用法代碼示例。如果您正苦於以下問題:Python Algorithm.polar_angle_sort方法的具體用法?Python Algorithm.polar_angle_sort怎麽用?Python Algorithm.polar_angle_sort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類algorithm.Algorithm
的用法示例。
在下文中一共展示了Algorithm.polar_angle_sort方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_polar_angle
# 需要導入模塊: from algorithm import Algorithm [as 別名]
# 或者: from algorithm.Algorithm import polar_angle_sort [as 別名]
def test_polar_angle(self):
point_array = [Point(1, 1), Point(2, 2), Point(2, 3), Point(2, 1)]
algo = Algorithm(point_array)
polar_list = algo.polar_angle_sort(Point(1,1))
self.assertEqual(str(polar_list[0]), str(Point(1, 1)))
self.assertEqual(str(polar_list[1]), str(Point(2, 1)))
self.assertEqual(str(polar_list[-1]), str(Point(2, 3)))
point_array = [Point(1, 1), Point(0, 2), Point(2, 3), Point(2, 1)]
algo = Algorithm(point_array)
polar_list = algo.polar_angle_sort(Point(1,1))
self.assertEqual(str(polar_list[-1]), str(Point(0,2)))
示例2: test_output_polar
# 需要導入模塊: from algorithm import Algorithm [as 別名]
# 或者: from algorithm.Algorithm import polar_angle_sort [as 別名]
def test_output_polar(self):
point_array = [
Point(19.2486849886, 42.0138353124),
Point(34.6545353825, 5.95845608147),
Point(66.6014654767, 66.0841191785),
Point(49.1321252346, 86.6154463314)
]
algo = Algorithm(point_array)
polar_list = algo.polar_angle_sort(Point(34.6545353825, 5.95845608147))
self.assertEqual(str(polar_list[0]), str(Point(34.6545353825, 5.95845608147)))