Пример #1
0
 def test_vertical_negative(self):
     x, y, a, b, r = 10, 5, 10, 20, 0
     f0, f1 = ret._ellipse_centre_to_focus(x, y, a, b, r)
     c = math.sqrt(b ** 2 - a ** 2)
     assert approx(f0) == (x, y + c)
     assert approx(f1) == (x, y - c)
Пример #2
0
 def test_horizontal_negative(self):
     x, y, a, b, r = 5, 20, 20, 10, 0
     f0, f1 = ret._ellipse_centre_to_focus(x, y, a, b, r)
     c = math.sqrt(a ** 2 - b ** 2)
     assert approx(f0) == (x + c, y)
     assert approx(f1) == (x - c, y)
Пример #3
0
 def test_rotated_negative45_ellipse(self):
     x, y, a, b, r = 10, 20, 10, 5, -math.pi / 4
     f0, f1 = ret._ellipse_centre_to_focus(x, y, a, b, r)
     c = math.sqrt(a ** 2 - b ** 2)
     assert approx(f0) == (x - c * math.sin(r), y - c * math.cos(r))
     assert approx(f1) == (x + c * math.sin(r), y + c * math.cos(r))
Пример #4
0
 def test_vertical_ellipse(self):
     x, y, a, b, r = 10, 20, 10, 5, math.pi / 2
     f0, f1 = ret._ellipse_centre_to_focus(x, y, a, b, r)
     c = math.sqrt(a ** 2 - b ** 2)
     assert f0 == (x, y + c)
     assert f1 == (x, y - c)
Пример #5
0
 def test_horizontal_ellipse(self):
     x, y, a, b, r = 10, 20, 20, 10, 0
     f0, f1 = ret._ellipse_centre_to_focus(x, y, a, b, r)
     c = math.sqrt(a ** 2 - b ** 2)
     assert f0 == (x + c, y)
     assert f1 == (x - c, y)
Пример #6
0
 def test_circle(self):
     x, y, a, b, r = 10, 20, 10, 10, 0
     f0, f1 = ret._ellipse_centre_to_focus(x, y, a, b, r)
     assert f0 == (x, y)
     assert f1 == (x, y)