Ejemplo n.º 1
0
 def test_compute_center_with_simple_square_angle(self):
     """Compute the center of the square in the next step given a right
     angle."""
     initial_square = Square(Point(0, 0), length=2, angle=math.pi / 2)
     point = self.builder._compute_center(
         initial_square, length=1.13, alpha=math.radians(68.57))
     expected_point = Point(1.15, 1.78)
     self.assertAlmostEqual(point.x, expected_point.x, places=1)
     self.assertAlmostEqual(point.y, expected_point.y, places=1)
 def test_compute_center_with_complex_square_angle(self):
     """Compute the center of the square in the next step given a more
     complex angle."""
     initial_square = Square(Point(1.5, 1.5), length=2.24, angle=math.radians(63.43))
     point = self.builder._compute_center(
         initial_square, length=1.65, alpha=math.radians(95.06)
     )
     expected_point = Point(3.48, 3.07)
     self.assertAlmostEqual(point.x, expected_point.x, places=1)
     self.assertAlmostEqual(point.y, expected_point.y, places=1)
Ejemplo n.º 3
0
 def test_compute_center_with_complex_square_angle_with_base_angle(self):
     """Compute the center of the square in the next step when there is a
     base angle - when the square does not touch the base square on the left
     edge."""
     initial_square = Square(
         Point(1.5, 1.5), length=2.24, angle=math.radians(63.43)
     )
     point = self.builder._compute_center(
         initial_square, length=1.51, alpha=math.radians(180 - 95.06),
         base_angle=math.radians(95.06))
     expected_point = Point(1.43, 3.98)
     self.assertAlmostEqual(point.x, expected_point.x, places=1)
     self.assertAlmostEqual(point.y, expected_point.y, places=1)