本文整理汇总了Python中circle.Circle.positive_intersection_with方法的典型用法代码示例。如果您正苦于以下问题:Python Circle.positive_intersection_with方法的具体用法?Python Circle.positive_intersection_with怎么用?Python Circle.positive_intersection_with使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类circle.Circle
的用法示例。
在下文中一共展示了Circle.positive_intersection_with方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initial_trilateration
# 需要导入模块: from circle import Circle [as 别名]
# 或者: from circle.Circle import positive_intersection_with [as 别名]
def initial_trilateration(p0, p1, distance_matrix):
points = [p0, p1]
for target_number in range(2, distance_matrix.shape[0]):
d0t = distance_matrix[0][target_number]
c0t = Circle(p0, d0t)
d1t = distance_matrix[1][target_number]
c1t = Circle(p1, d1t)
points.append(c0t.positive_intersection_with(c1t))
return points
示例2: CircleTester
# 需要导入模块: from circle import Circle [as 别名]
# 或者: from circle.Circle import positive_intersection_with [as 别名]
class CircleTester(unittest.TestCase):
def setUp(self):
self.c0 = Circle(point.Point(4, 0.5), 5)
self.c1 = Circle(point.Point(1, -1), 4)
def test_intersection(self):
intersection = self.c0.intersection_with(self.c1)
# as per: http://www.calcul.com/circle-circle-intersection
p0 = point.Point(3.0825543469976, -4.4151086939952)
p1 = point.Point(-0.48255434699759, 2.7151086939952)
expected = [p0, p1]
self.assertAlmostEqual(intersection[0].x, expected[0].x)
self.assertAlmostEqual(intersection[0].y, expected[0].y)
self.assertAlmostEqual(intersection[1].x, expected[1].x)
self.assertAlmostEqual(intersection[1].y, expected[1].y)
def test_positive_intersection(self):
intersection = self.c0.positive_intersection_with(self.c1)
expected = point.Point(-0.48255434699759, 2.7151086939952)
self.assertAlmostEqual(intersection.x, expected.x)
self.assertAlmostEqual(intersection.y, expected.y)