Ejemplo n.º 1
0
 def test_translate_coordinates_between_systems3(self):
     try:
         expected_x, expected_y = 0, 0
         x, y = utils.translate_coordinates_between_systems(0, 0, 0, 0, 0)
         self.assertTrue(math.isclose(x, expected_x))
         self.assertTrue(math.isclose(y, expected_y))
     except AssertionError:
         raise AssertionError(
             'x: {} should be {}, y: {} should be {}'.format(
                 x, expected_x, y, expected_y))
Ejemplo n.º 2
0
 def test_translate_coordinates_between_systems_quadrant_2_2(self):
     try:
         expected_x, expected_y = -2, 3
         x, y = utils.translate_coordinates_between_systems(
             -1, -4, 2, -2, radians(90))
         self.assertTrue(math.isclose(x, expected_x))
         self.assertTrue(math.isclose(y, expected_y))
     except AssertionError:
         raise AssertionError(
             'x: {} should be {}, y: {} should be {}'.format(
                 x, expected_x, y, expected_y))
Ejemplo n.º 3
0
 def test_translate_coordinates_between_systems_quadrant_1(self):
     try:
         expected_x, expected_y = math.sqrt(2), 0
         x, y = utils.translate_coordinates_between_systems(
             2, 2, 1, 1, math.pi / 4)
         self.assertTrue(math.isclose(x, expected_x))
         self.assertTrue(math.isclose(y, expected_y))
     except AssertionError:
         raise AssertionError(
             'x: {} should be {}, y: {} should be {}'.format(
                 x, expected_x, y, expected_y))
Ejemplo n.º 4
0
 def test_translate_coordinates_between_systems_quadrant_3(self):
     try:
         expected_x, expected_y = -math.cos(math.pi / 4) * 2, math.sin(
             math.pi / 4) * 2
         x, y = utils.translate_coordinates_between_systems(
             0, 2, 2, 2, radians(-135))
         self.assertTrue(math.isclose(x, expected_x))
         self.assertTrue(math.isclose(y, expected_y))
     except AssertionError:
         raise AssertionError(
             'x: {} should be {}, y: {} should be {}'.format(
                 x, expected_x, y, expected_y))